The gastrointestinal tract of mammals is inhabited by hundreds of distinct species of commensal microorganisms that exist in a mutualistic relationship with the host. How commensal microbiota influence the host immune system is poorly understood. We show here that colonization of the small intestine of mice with a single commensal microbe, segmented filamentous bacterium (SFB), is sufficient to induce the appearance of CD4(+) T helper cells that produce IL-17 and IL-22 (Th17 cells) in the lamina propria. SFB adhere tightly to the surface of epithelial cells in the terminal ileum of mice with Th17 cells but are absent from mice that have few Th17 cells. Colonization with SFB was correlated with increased expression of genes associated with inflammation and antimicrobial defenses and resulted in enhanced resistance to the intestinal pathogen Citrobacter rodentium. Thus, manipulation of this commensal-regulated pathway may provide new opportunities for enhancing mucosal immunity and treating autoimmune disease.