Check your bed's slats. Many beds feature wooden slats that box springs and mattresses rest on, though they can sometimes slip from the bed rail cleats. This causes the bed rails to bulge or sag, which can result in the entire bed crashing to the floor. Remove the mattress and, if applicable, the box spring from the bed frame.
Place the slats back in their proper position and use pipe clamps to pull the rails back in and keep them in place as you work. Use a drill to make pilot holes through the ends of each slat. Making holes on the ends of each slat also prevents the slats from splitting. Attach the slats to the bed rail cleats with screws to keep them in place.
Use a bed repair package to fix sagging bed rails if repairing slats is not enough or slats have rotted through. Such packages feature heavy-duty steel support brackets that keep beds in place and bring rails back in line. They include screws and mounting plates for easy installation. Follow the manufacturer's instructions to attach the plates and brackets to the sides of your rails with the screws.