Abstract: This study implements an algorithm for the autonomous control of spinal alignment during sleep by the active adjustment of mechanical bed characteristics according to the adopted sleep posture. Bed systems were used that allow active control of the mechanical stiffness in eight comfort zones by means of separately adjustable actuators. Mattress indentation measurements provide the input to detect body movement, recognize sleep posture, and – by combination with a subject specific human model – estimate spine shape. Comparison between the estimated spine shape and the desired shape results in new target values for the actuators. The control loop is repeated until the desired spine shape is reached. Results of overnight experiments revealed a significant improvement of spinal alignment during nights with active control of bed properties compared to a reference night without control. In addition, a significant improvement on subjectively perceived sleep quality was demonstrated after sleeping on the actively controlled systems.