If your bed is sprung apart at the top, that comes from hauling wide heavy loads, somewhere in the past. I don't think you will make much progress taking the bolts out to fix it. Do as you were thinking about and pull the sides together with a winch setup. You will have to do it with the tailgate open and pull a small amount further than it needs, to stay after it is released.