Sleep plays a vital role in enhancing immune function, particularly through deep sleep stages that allow the body to conserve energy for fighting infections. When battling an illness, the immune system not only affects sleep patterns but also increases deep sleep to facilitate a higher fever response. Interestingly, muscle atonia during REM sleep prevents shivering, emphasizing the body's strategic use of sleep to combat illness effectively.