Interactions between commensals and the host impact the metabolic and immune status of metazoans. Their deregulation is associated with age-related pathologies like chronic inflammation and cancer, especially in barrier epithelia. Maintaining a healthy commensal population by preserving innate immune homeostasis in such epithelia thus promises to promote health and longevity. Here, we show that, in the aging intestine of Drosophila, chronic activation of the transcription factor Foxo reduces expression of peptidoglycan recognition protein SC2 (PGRP-SC2), a negative regulator of IMD/Relish innate immune signaling, and homolog of the anti-inflammatory molecules PGLYRP1-4. This repression causes deregulation of Rel/NFkB activity, resulting in commensal dysbiosis, stem cell hyperproliferation, and epithelial dysplasia. Restoring PGRP-SC2 expression in enterocytes of the intestinal epithelium, in turn, prevents dysbiosis, promotes tissue homeostasis, and extends lifespan. Our results highlight the importance of commensal control for lifespan of metazoans and identify SC-class PGRPs as longevity-promoting factors.