If the brake fluid level is OK as Todd mentioned above, then it's probably the alternator.

The alternator "charge" and the "brake" lights are in an oddball circuit configuration in Toyotas.

Long story short, when there is no alternator output or, (if you have a 7.5 amp fuse labeled "chg" for "charge") if that fuse is blown, both lights will also come on.

Since your symptoms are intermittent flashing of both lights, (assuming brake fluid level OK) the next likely cause is the alternator slip ring brushes are on their last leg..

It's a fairly simple job the pull and replace the brushes as shown in kewlynx's link above...