Bed, comprising a lower frame (1) and an upper frame (2) with a supporting surface for a mattress, and where the upper frame (2) is connected to the lower frame (1) so that the upper frame can be raised and lowered in proportion to the lower frame by means of one or more adjusting means (5, 6) driven by an electric motor. In order to prevent squeezing between the upper and lower frame when the upper frame is lowered, the bed is provided with anti squeezing means. These comprise a light source and a receiver positioned in a corner of the lower frame. The light source sends a light beam which follows the lower frame all the way around and runs just above the top side of the lower frame. When the light beam is interrupted the control unit reacts by cutting off the current for the motors.