Some people remain healthier throughout life than others but the underlying reasons are poorly understood. Here we hypothesize this advantage is attributable in part to optimal immune resilience (IR), defined as the capacity to preserve and/or rapidly restore immune functions that promote disease resistance (immunocompetence) and control inflammation in infectious diseases as well as other causes of inflammatory stress. We gauge IR levels with two distinct peripheral blood metrics that quantify the balance between (i) CD8+and CD4+T-cell levels and (ii) gene expression signatures tracking longevity-associated immunocompetence and mortality-associated inflammation. Profiles of IR metrics in ~48,500 individuals collectively indicate that some persons resist degradation of IR both during aging and when challenged with varied inflammatory stressors. With this resistance, preservation of optimal IR tracked (i) a lower risk of HIV acquisition, AIDS development, symptomatic influenza infection, and recurrent skin cancer; (ii) survival during COVID-19 and sepsis; and (iii) longevity. IR degradation is potentially reversible by decreasing inflammatory stress. Overall, we show that optimal IR is a trait observed across the age spectrum, more common in females, and aligned with a specific immunocompetence-inflammation balance linked to favorable immunity-dependent health outcomes. IR metrics and mechanisms have utility both as biomarkers for measuring immune health and for improving health outcomes.