My Brake Light Comes On When I'm In 4WD

I have a 2002 Suzuki XL-7. My brake light in general comes on every once in a while. I had already replaced my brakes and the fluid was full. I went to my mechanic and they couldn’t find anything wrong. They said that it was most likely just a bad sensor. Now that it’s winter I have used my 4WD a few times and I notice every time I go into 4WD that my brake light turns on. Even after I go back to 2WD it still stays on for awhile. Is this the sensor acting up or could it be something more?