Headlight switch not working

I have a 1996 Ford Explorer all wheel drive. Recently, the headlights are turning off and on at random. Luckily, they always go on, and stay on, when switched on, and go off when the vehicle is shut down. But it’s a little weird to have them turn off and on at random times during daylight hours. Does anyone have a suggestion for a quick fix?