The gut microbiota affects the physiology and metabolism of animals and its alteration can lead to diseases such as gut dysplasia or metabolic disorders. Several reports have shown that the immune system plays an important role in shaping both bacterial community composition and abundance in Drosophila, and that immune deficit, especially during aging, negatively affects microbiota richness and diversity. However, there has been little study at the effector level to demonstrate how immune pathways regulate the microbiota. A key set of Drosophila immune effectors are the antimicrobial peptides (AMPs), which confer defense upon systemic infection. AMPs and lysozymes, a group of digestive enzymes with antimicrobial properties, are expressed in the gut and are good candidates for microbiota regulation. Here, we take advantage of the model organism Drosophila melanogaster to investigate the role of AMPs and lysozymes in regulation of gut microbiota structure and diversity.Using flies lacking AMPs and newly generated lysozyme mutants, we colonized gnotobiotic flies with a defined set of commensal bacteria and analyzed changes in microbiota composition and abundance in vertical transmission and aging contexts through 16S rRNA gene amplicon sequencing. Our study shows that AMPs and, to a lesser extent, lysozymes are necessary to regulate the total and relative abundance of bacteria in the gut microbiota. We also decouple the direct function of AMPs from the IMD signaling pathway that regulates AMPs but also many other processes, more narrowly defining the role of these effectors in the microbial dysbiosis observed in IMD-deficient flies upon aging.ImportanceThis study advances current knowledge in the field of host-microbe interactions by demonstrating that the two families of immune effectors, antimicrobial peptides and lysozymes, actively regulate the gut microbiota composition and abundance. Consequences of the loss of these antimicrobial peptides and lysozymes are exacerbated during aging, and their loss contributes to increased microbiota abundance and shifted composition in old flies. This work shows that immune effectors, typically associated with resistance to pathogenic infections, also help shape the beneficial gut community, consistent with the idea that host-symbiont interactions use the same âlanguageâ typically associated with pathogenesis.