Intestinal homeostasis is achieved, in part, by the integration of a complex set of mechanisms that eliminate pathogens and tolerate the indigenous microbiota. Drosophila melanogaster feeds on microorganism-enriched matter and therefore has developed efficient mechanisms to control ingested microorganisms. Regulatory mechanisms ensure an appropriate level of immune reactivity in the gut to accommodate the presence of beneficial and dietary microorganisms, while allowing effective immune responses to clear pathogens. Maintenance of D. melanogaster gut homeostasis also involves regeneration of the intestine to repair damage associated with infection. Entomopathogenic bacteria have developed common strategies to subvert these defence mechanisms and kill their host.