Theres 2 switches on the brake pedal. 1 for the stop lights (plunger type switch) and another one (hall effect type switch).
The hall effect one very rairly plays up. Replace the plunger type switch, this has a ratchet built in to make it self adjusting, when fitting, push the brake pedal down and twist the switch into place then release the brake pedal, you'll hear the ratchet click as the switch sets itself.