Hi, welcome to JustAnswer!. This is Ed.
What you're describing would be consistent with either a misadjusted stop lamp/ brake switch or that your brake pedal isn't returning to its full up-stop position. The stop lamp switch actually three internal switches, one for the rear stop lamps and two for electronic signaling at the PCM and ABS modules. The second two switches are used for driveability purposes (to tell the PCM that you're braking and it will need to take over idle control), speed control (cancel on braking) and basic antilock brake functions. The switch also triggers the shift interlock solenid, which is probably the clicking you hear.
The brake switch is self-adjusting and is set when the unit is first installed. As the brake pedal is allowed to return to its rest position, it pushes the switch contact and allows a ratchet mechanism to push it into the switch body, setting it for life. After set, it takes a very slight amount of pedal travel to close all three switches, as you'd want in a brake pedal switch unit. If the switch contact gets pushed in too far, the pedal will be on the verge of turning lights and shift interlock on at all times, which is probably what your problem is. With three internal switches (and all that redundancy) I can't imagine that you could suddenly have three individual switch failures... it's much more likely that the whole switch assembly is mis-positioned.
Either that or the pedal can't return to its full-up position. When it acts up again, try lifting the pedal with your foot to gauge how much the pedal actually moves and whether this is an effective maneuver. If the pedal does move more than a quarter-inch, it suggests a problem with the booster assembly or that something is interfering with pedal movement. A closer look will be needed in that case.