2000 Corolla with 68K miles. Last year, replace turn signal relay and AC relay.
When I drive now, the brake light in the dashboard comes on randomly. It looks like it happens most when accelerating. It stays on for about 20 seconds then disappears and comes on again when I brake or slow down.
What does your owners manual say? Brakes pad wear, brake leak, and alternator problem are all possibly linked to this Toyota warning light according to what I’ve read here just now, and over the years.
As @SteveC76 say, Toyota has a gadget which measure the brake fluid level. If that switch goes bad, or the linkage between the float which does the measurement and the switch, this could happen. It’s especially likely b/c you say it happens during acceleration.
Double check that your brake fluid is between the max and min line though. Remove the cap and look down that hole to verify the fluid level is where you think it is, not just from the outside of the bottle.
Also make sure both the brake light and alternator light come on with the key in “on” but the engine not started. There’s a fail-safe linkage between the alternator and brake light warning system, so if one of those warning dash light bulb fails, the other will at least light up and warn the driver something needs immediate servicing.
It sounds 100% like low brake fluid. Wipe the reservoir off with a rag and look closely at the level of the fluid. Most likely it is right around the “low” line. Add fluid to bring it up the “Max” level. Opening the reservoir and looking inside is a meaningless exercise. You have to check the fluid level from the side using the lines on the tank.
Except in the unlikely event of a brake fluid leak, it’s caused by the pads gradually wearing. Entirely to be expected. As posted above, the best practice provided adequate fluid remains for safe braking is to not add any more brake fluid until the pads have been checked, usually they’d check one wheel, front & back. Presumably you have discs on the back too, so that’s a quick job, any inde shop could do it for you in a jiffy. The pads can be checked just by temporarily removing the wheel.
If both front and back pads are worn a bit, but still serviceable, top off the fluid in the bottle and drive on. If one or both need new pads, don’t add more fluid, b/c when the new pads are installed it will overflow the bottle and make a mess if you add more fluid now.
If new fluid is added, make sure it is the exact type recommended by Toyota in the owner’s manual.