The Citrobacter rodentium model mimics the pathogenesis of infectious colitis and requires sequential contributions from different immune cell populations, including innate lymphoid cells (ILCs) and CD4+ lymphocytes. In this study, we addressed the role of STAT3 activation in CD4+ cells during host defense in mice against C. rodentium. In mice with defective STAT3 in CD4+ cells (Stat3ΔCD4), the course of infection was unchanged during the innate lymphoid cell–dependent early phase, but significantly altered during the lymphocyte-dependent later phase. Stat3ΔCD4 mice exhibited intestinal epithelial barrier defects, including downregulation of antimicrobial peptides, increased systemic distribution of bacteria, and prolonged reduction in the overall burden of C. rodentium infection. Immunomonitoring of lamina propria cells revealed loss of virtually all IL-22–producing CD4+ lymphocytes, suggesting that STAT3 activation was required for IL-22 production not only in Th17 cells, but also in Th22 cells. Notably, the defective host defense against C. rodentium in Stat3∆CD4 mice could be fully restored by specific overexpression of IL-22 through a minicircle vector–based technology. Moreover, expression of a constitutive active STAT3 in CD4+ cells shaped strong intestinal epithelial barrier function in vitro and in vivo through IL-22, and it promoted protection from enteropathogenic bacteria. Thus, our work indicates a critical role of STAT3 activation in Th17 and Th22 cells for control of the IL-22–mediated host defense, and strategies expanding STAT3-activated CD4+ lymphocytes may be considered as future therapeutic options for improving intestinal barrier function in infectious colitis.