The most common cause of the brake light coming on while braking is low brake fluid. Many auto parts stores will help you check brake fluid levels free of charge.
This has happen to me before and the problem was caused by low brake fluid. Change out your brake fluid and check for leaks around the reservoir and master cylinder.