Eating unhealthy meals, drinking too much alcohol, smoking, and not getting enough sleep can weaken your immune system and increase the risk of infections.