The mammalian gastrointestinal tract contains a large and diverse population of commensal bacteria and is also one of the primary sites of exposure to pathogens. How the immune system perceives commensals in the context of mucosal infection is unclear. Here, we show that during a gastrointestinal infection, tolerance to commensals is lost, and microbiota-specific T cells are activated and differentiate to inflammatory effector cells. Furthermore, these T cells go on to form memory cells that are phenotypically and functionally consistent with pathogen-specific T cells. Our results suggest that during a gastrointestinal infection, the immune response to commensals parallels the immune response against pathogenicmicrobes and that adaptive responses against commensals are an integral component of mucosal immunity.