The commensal microbiome has been shown to protect against newly introduced enteric pathogens in multiple host species, a phenomenon known as a priority effect. Multiple mechanisms can contribute to this protective priority effect, including antimicrobial compounds, nutrient competition, and pH changes. InDrosophila melanogaster,Lactiplantibacillus plantarumhas been shown to protect against enteric pathogens. However, the strains ofL. plantarumstudied were derived from laboratory flies or non-fly environments and have been found to be unstable colonizers of the fly gut that mainly reside on the food. To study the priority effect using a naturally occurring microbial relationship, we isolated a wild-fly derived strain ofL. plantarumthat stably colonizes the fly gut in conjunction with a common enteric pathogen,Serratia marcescens. Flies stably associated with theL. plantarumstrain were more resilient to oralSerratia marcescensinfection as seen by longer lifespan and lowerS. marcescensload in the gut. Throughin vitroexperiments, we found thatL. plantaruminhibitsS. marcescensgrowth due to acidification. We used gut imaging with pH-indicator dyes to show thatL. plantarumreduces the gut pH to levels that restrictS. marcescensgrowthin vivo. In flies colonized withL. plantarumprior toS. marcescensinfection,L. plantarumandS. marcescensare spatially segregated in the gut andS. marcescensis less abundant whereL. plantarumheavily colonizes, indicating that acidification of specific gut regions is a mechanism of a protective priority effect.