+1 on the switch
A contact inside overheats and opens the circuit, shutting the lights off. Then with no current flow, it eventually cools off enough to close the circuit, turning the lights back on. The process repeats itself. This is how the turn signal and hazard light blinking mechanisms work, although by design as opposed to what you are dealing with for headlights.
I've had one fail even with the standard (non halogen) lights.
If you need the halogens or other higher load bulb set, you should either install an interposing relay or, better yet, find out if someone makes a repop with a higher current capacity. The relay is more involved and is an extra device that could fail and result in no headlights. Also if you modify any circuit carefully consider the power source and fuse/fuse link size - we don't want to melt any insulation and start a fire.