Hello and welcome to JustAnswer!
This could be a few things.
Try swapping out the high beam relay with another relay and see if that helps. The problem could just be the relay itself.
The dimmer switch could also be causing the issue.
The dimmer switch reports to the body control module (BCM) and the BCM controls the high beam relay. The BCM could be allowing the relay to turn off even though the switch signal is ok.
It could also be a wiring problem between the switch and BCM, or between the BCM and relay.