Bacteria generally live in species-rich communities, such as the gut microbiota. Yet little is known about bacterial evolution in natural ecosystems. Here, we followed the longterm evolution of commensal Escherichia coli in the mouse gut. We observe the emergence of mutation rate polymorphism, ranging from wild-type levels to 1,000-fold higher. By combining experiments, whole-genome sequencing, and in silico simulations, we identify the molecular causes and explore the evolutionary conditions allowing these hypermutators to emerge and coexist within the microbiota. The hypermutator phenotype is caused by mutations in DNA polymerase III proofreading and catalytic subunits, which increase mutation rate by approximately 1,000-fold and stabilise hypermutator fitness, respectively. Strong mutation rate variation persists for >1,000 generations, with coexistence between lineages carrying 4 to >600 mutations. The in vivo molecular evolution pattern is consistent with fitness effects of deleterious mutations s d � 10 −4 /generation, assuming a constant effect or exponentially distributed effects with a constant mean. Such effects are lower than typical in vitro estimates, leading to a low mutational load, an inference that is observed in in vivo and in vitro competitions. Despite large numbers of deleterious mutations, we identify multiple beneficial mutations that do not reach fixation over long periods of time. This indicates that the dynamics of beneficial mutations are not shaped by constant positive Darwinian selection but could be explained by other evolutionary mechanisms that maintain genetic diversity. Thus, microbial evolution in the gut is likely characterised by partial sweeps of beneficial mutations combined with hitchhiking of slightly deleterious mutations, which take a long time to be purged because they impose a low mutational load. The combination of these two processes could allow for the longterm maintenance of intraspecies genetic diversity, including mutation rate polymorphism. These results are consistent with the pattern of genetic polymorphism that is emerging from metagenomics studies of the human gut microbiota, suggesting that we have identified key evolutionary processes shaping the genetic composition of this community.