My Father in law has a 2006 Ford f250 and a 2004 cougar 5th wheel. He has had some problems with his brake controller/ brakes not working. He can take a 10 hour trip each way with no problems but then...
The next time that it happens, I would yank the trailers brake breakaway cable and see if it locks up the trailer brakes. That would at least give you a starting point. If the brakes lockup, suspect the truck's brake controller or the connectors. If the brakes don't lockup, the problem is definitely in the trailer brakes.
EDIT You may want to unplug the trailer from the truck, befor yanking the breakaway.