Close friend had the same problem with his '15 F-150. After the dealer sending him a brand new 7 pin trailer connection, the issue still persisted. Turns out, there was a bad ground. After finding the bad ground on his trailer, the problem has not come back since. Chase your grounds, both truck side, and trailer side. Hope this helps, good luck!
'18 Rockwood Signature Ultra Lite 8299BS
'14 Salem Cruise Lite 261BHXL (SOLD)
Tow Rig: 2014 RAM 2500 Laramie Longhorn 6.7L Diesel