c Th17 immunity in the gastrointestinal tract is regulated by the intestinal microbiota composition, particularly the presence of segmented filamentous bacteria (sfb), but the role of the intestinal microbiota in pulmonary host defense is not well explored. We tested whether altering the gut microbiota by acquiring sfb influences the susceptibility to staphylococcal pneumonia via induction of type 17 immunity. Groups of C57BL/6 mice which differed in their intestinal colonization with sfb were challenged with methicillin-resistant Staphylococcus aureus in an acute lung infection model. Bacterial burdens, bronchoalveolar lavage fluid (BALF) cell counts, cell types, and cytokine levels were compared between mice from different vendors, mice from both vendors after cohousing, mice given sfb orally prior to infection, and mice with and without exogenous interleukin-22 (IL-22) or anti-IL-22 antibodies. Mice lacking sfb developed more severe S. aureus pneumonia than mice colonized with sfb, as indicated by higher bacterial burdens in the lungs, lung inflammation, and mortality. This difference was reduced when sfb-negative mice acquired sfb in their gut microbiota through cohousing with sfb-positive mice or when given sfb orally. Levels of type 17 immune effectors in the lung were higher after infection in sfb-positive mice and increased in sfb-negative mice after acquisition of sfb, as demonstrated by higher levels of IL-22 and larger numbers of IL-22؉ TCR ؉ cells and neutrophils in BALF. Exogenous IL-22 protected mice from S. aureus pneumonia. The murine gut microbiota, particularly the presence of sfb, promotes pulmonary type 17 immunity and resistance to S. aureus pneumonia, and IL-22 protects against severe pulmonary staphylococcal infection.