Local immune responses serve to contain infections by pathogens to the gut while preventing pathogen dissemination to systemic sites. Several subsets of T cells in the gut (T-helper 17 cells, gammadelta T cells, natural killer (NK), and NK-T cells) contribute to the mucosal response to pathogens by secreting a subset of cytokines including interleukin (IL)-17A, IL-17F, IL-22, and IL-26. These cytokines induce the secretion of chemokines and antimicrobial proteins, thereby orchestrating the mucosal barrier against gastrointestinal pathogens. While the mucosal barrier prevents bacterial dissemination from the gut, it also promotes colonization by pathogens that are resistant to some of the inducible antimicrobial responses. In this review, we describe the contribution of Th17 cytokines to the gut mucosal barrier during bacterial infections.