The impact of commensal bacteria on the host arises from complex microbial-diet-host interactions. Mapping metabolic interactions in gut microbial communities is therefore key to understand how the microbiome influences the host. Here we use an interdisciplinary approach including isotope-resolved metabolomics to show that in Drosophila melanogaster, Acetobacter pomorum (Ap) and Lactobacillus plantarum (Lp) establish a syntrophic relationship to overcome detrimental host diets and identify Ap as the bacterium altering the host's feeding decisions. Specifically, we show that Lp generates lactate which is used by Ap to produce and provide amino acids that are essential to Lp allowing it to grow in imbalanced diets. Lactate is also necessary and sufficient for Ap to alter the fly's protein appetite. Our data show that gut bacterial communities use metabolic interactions to become resilient to detrimental host diets and to ensure the constant flow of metabolites used by effector bacteria to alter host behaviour.Drosophila, feeding behaviour, microbiome, commensal bacteria, nutrition, bacterial communities, essential amino acids, syntrophy, metabolic crossfeeding, Acetobacteracaea, Lactobacilli Correspondence: carlos.ribeiro@neuro.fchampalimaud.org