Replace the headlight switch. Once they get bad enough it happens on low beams also. When they heat up they kick out until they cool off. It's a known problem on our 2nd gen Rams. 20-25 dollars at Napa, do not buy a BWD switch for this app, I had 2 bad ones in a row.
Watch out for the sneaky screw by the power outlet, pull the tilt wheel all the way down, pull the shifter into low if AT (set the brake first), and pull the bezel gently towards you to release the clips.
That bezel is $$$$ so be careful. All you need is a phillips, 10 minute job.
BTW the new switch will not come with the knob, the little silver spring loaded button on the bottom of the switch releases it.