It may sound odd, but the immune system depends on inflammation to get its job done. The Sleep Foundation explains that inflammation strengthens the body's healing process by increasing the amount of cytokines that white blood cells produce.
This process takes place whether you are sick or not, and it happens when you sleep. Specifically, it occurs during deep sleep, when the metabolism is the lowest, so it's important to not only get sleep but to get deep, restful sleep.
Researchers believe that if this kind of inflammation occurred during waking hours, it would impede physical and mental functions. Getting less than six or seven hours of sleep per night on a regular basis can negatively affect immune function, because your immune system can't do everything it needs to do to keep you healthy.
Additionally, a lack of sleep has been linked to a higher risk of diabetes, heart disease, and certain infections like the common cold and flu. If you find you have trouble sleeping, you can try working on a bedtime routine that includes consistent sleep hours and avoiding blue screens before bed.