Predominant members of the human gut microbiota show temporal stability despite exposure to the host inflammatory response, but the mechanisms involved are poorly understood. Cullen et al. show that the dominant gut phyla are resistant to inflammation-associated antimicrobial peptides (AMPs), and that in the common gut commensal Bacteroides thetaiotaomicron, resistance is mediated by a lipopolysaccharide (LPS) modification. The authors found that the bacterial phosphatase LpxF — which catalyses the removal of the 4′-phosphate group from the lipid A moiety of LPS — increases resistance to AMPs by reducing AMP-dependent membrane disruption. In mice that were colonized with representatives of the human gut microbiota, wild-type B. thetaiotaomicron was temporally stable following infection with the enteropathogen Citrobacter rodentium, whereas a B. thetaiotaomicron lpxF-null mutant was rapidly and specifically depleted. These data highlight the importance of LpxF activity for the persistence of B. thetaiotaomicron following pathogen-triggered inflammation. As LpxF orthologues are widespread, this may be a common strategy used by gut commensals to resist host inflammation.