During sleep, the immune system produces cytokines, proteins that help fight infection and inflammation. Lack of sleep can weaken the immune response, making the body more susceptible to illnesses.