Abstract The intestines of animals are typically colonized by a complex, relatively stable microbiota that influences health and fitness, but the underlying mechanisms of colonization remain poorly understood. As a typical animal, the fruit fly, Drosophila melanogaster, is associated with a consistent set of commensal bacterial species, yet the reason for this consistency is unknown. Here, we use gnotobiotic flies, microscopy, and microbial pulse-chase protocols to show that a commensal niche exists within the proventriculus region of the Drosophila foregut that selectively binds bacteria with exquisite strain-level specificity. Primary colonizers saturate the niche and exclude secondary colonizers of the same strain, but initial colonization by Lactobacillus physically remodels the niche to favor secondary colonization by Acetobacter . Our results provide a mechanistic framework for understanding the establishment and stability of an intestinal microbiome. One-Sentence Summary A strain-specific set of bacteria inhabits a defined spatial region of the Drosophila gut that forms a commensal niche.