Poor diet, lack of sleep, chronic stress, smoking, excessive alcohol, and physical inactivity can all impair immune function over time. Making positive changes in these areas can strengthen immunity.