The mammalian gastrointestinal tract harbors thousands of bacterial species that include symbionts as well as potential pathogens. The immune responses that limit access of these bacteria to underlying tissue remain poorly defined. Here we show that γδ intraepithelial lymphocytes (γδ IEL) of the small intestine produce innate antimicrobial factors in response to resident bacterial "pathobionts" that penetrate the intestinal epithelium. γδ IEL activation was dependent on epithelial cell-intrinsic MyD88, suggesting that epithelial cells supply microbe-dependent cues to γδ IEL. Finally, γδ T cells protect against invasion of intestinal tissues by resident bacteria specifically during the first few hours after bacterial encounter, indicating that γδ IEL occupy a unique temporal niche among intestinal immune defenses. Thus, γδ IEL detect the presence of invading bacteria through cross-talk with neighboring epithelial cells and are an essential component of the hierarchy of immune defenses that maintain homeostasis with the intestinal microbiota.