, without nutrient depletion and intense inter-individual interactions), we 210 designed a second experimental setup that is summarized in Fig. S2. In essence, 211 larvae were reared under low larval density but with high amounts of waste products

, Renault and Colinet 2018) accumulated 214 substantially in food under crowding situation. Consequently, only these two molecules 215 (and not uric acid) were supplemented in food using nominal concentrations that were 216 experimentally found in HD food: 1.2 mg.mL -1 for ammonia (Merck Millipore, 105432) 217 (see results section), and 5 mg. mL -1 for urea (PanReac, PA6ACS) (see Henry et al., 218 2018). The experimental design included four treatments: Co (control, no 219 supplementation), Ur (urea supplementation), Am (ammonia supplementation), UrAm 220 (urea and ammonia supplementation) (see Fig. S2). For all treatments, Of the three putative nitrogenous wastes excreted by Drosophila, only ammonia (see 213 in the present study) and urea (see Henry

X. Bing, J. Gerlach, and G. Loeb, Nutrient-Dependent Impact of Microbes on Drosophila 533 suzukii, Development. mBio, vol.9, pp.2199-2216, 2018.

J. E. Blum, C. N. Fischer, and J. Miles, Frequent replenishment sustains the beneficial 535 microbiome of Drosophila melanogaster, MBio, vol.4, pp.860-00813, 2013.

D. J. Borash, A. G. Gibbs, and A. Joshi, A Genetic Polymorphism Maintained by Natural 537 Selection in a Temporally Varying Environment, The American Naturalist, vol.538, pp.148-56, 1998.

D. J. Borash, H. Teotónio, and M. R. Rose, Density-dependent natural selection in 540 Drosophila: correlations between feeding rate, development time and viability, Journal of Evolutionary Biology, vol.541, pp.181-188, 2000.

L. Börger and J. Fryxell, Quantifying individual differences in dispersal using net squared 543 displacement -Oxford Scholarship. Dispersal in Ecology and Evolution, pp.222-252, 2012.

L. M. Botella, A. Moya, and M. C. González, Larval stop, delayed development and survival 546 in overcrowded cultures of Drosophila melanogaster: Effect of urea and uric 547 acid, Journal of Insect Physiology, vol.31, pp.179-85, 1985.

T. Brummel, A. Ching, and L. Seroude, Drosophila lifespan enhancement by exogenous 549 bacteria, PNAS, vol.101, pp.12974-12983, 2004.

E. Bursell, The Excretion of Nitrogen in Insects, Beament JWL, p.551

, Advances in Insect Physiology, vol.4, pp.33-67, 1967.

J. A. Chandler, J. A. Eisen, and A. Kopp, Yeast communities of diverse Drosophila species: 554 comparison of two symbiont groups in the same hosts, Appl Environ Microbiol, vol.555, pp.7327-7363, 2012.

M. J. Crawley and M. P. Gillman, Population Dynamics of Cinnabar Moth and Ragwort in 557

. Grassland, Journal of Animal Ecology, vol.58, pp.1035-50, 1989.

C. L. David, V. A. Pierce, and D. W. Aswad, The effect of urea exposure on isoaspartyl 559 content and protein l-isoaspartate methyltransferase activity in Drosophila 560 melanogaster, Comparative Biochemistry and Physiology Part B: Biochemistry 561 and Molecular Biology, vol.124, pp.423-430, 1999.

A. E. Douglas, The Drosophila model for microbiome research, Lab Animal, vol.563, pp.157-64, 2018.

G. M. Douglas, V. J. Maffei, and J. Zaneveld, PICRUSt2: An improved and extensible 565 approach for metagenome inference, p.672295, 2019.

B. Erkosar, S. Kolly, J. R. Meer, and . Van-der, Adaptation to Chronic Nutritional Stress 570 Leads to Reduced Dependence on Microbiota in Drosophila melanogaster, 571 mBio, vol.8, pp.1496-1513, 2017.

B. Erkosar and F. Leulier, Transient adult microbiota, gut homeostasis and longevity: Novel 573 insights from the Drosophila model, FEBS Letters, vol.588, pp.4250-4257, 2014.

B. Erkosar, G. Storelli, and A. Defaye, Host-intestinal microbiota mutualism: "learning 575 on the fly, Cell Host Microbe, vol.13, pp.8-14, 2013.

B. Erkosar, E. Yashiro, and F. Zajitschek, Host diet mediates a negative relationship 577 between abundance and diversity of Drosophila gut microbiota, Ecology and 578 Evolution, vol.8, pp.9491-502, 2018.

F. Escudié, L. Auer, and M. Bernard, FROGS: Find, Rapidly, OTUs with Galaxy Solution. 580 Bioinformatics, 2016.

R. Etienne, K. Fortunat, and V. Pierce, Mechanisms of urea tolerance in urea-adapted 582 populations of Drosophila melanogaster, Journal of Experimental Biology, vol.583, pp.2699-707, 2001.

A. François, D. Grebert, and M. Rhimi, Olfactory epithelium changes in germfree mice, p.585

, Sci Rep, vol.6, 2016.

T. B. Friedman, Observations on the regulation of uricase activity during development of 587 Drosophila melanogaster, Biochem Genet, vol.8, pp.37-45, 1973.

Y. Henry, C. Piscart, and S. Charles, Combined effect of temperature and ammonia on 589 molecular response and survival of the freshwater crustacean Gammarus pulex, Ecotoxicology and Environmental Safety, vol.590, pp.42-50, 2017.

Y. Henry, D. Renault, and H. Colinet, Hormesis-like effect of mild larval crowding on 592 thermotolerance in Drosophila flies, Journal of 593 Experimental Biology, vol.221, p.178681, 2018.

A. J. Hilliker, B. Duyf, and D. Evans, Urate-null rosy mutants of Drosophila melanogaster 595 are hypersensitive to oxygen stress, PNAS, vol.89, pp.4343-4350, 1992.

B. Horváth and A. T. Kalinka, Effects of larval crowding on quantitative variation for 597 development time and viability in Drosophila melanogaster, Ecol Evol, vol.598, pp.8460-73, 2016.

T. Hothorn, F. Bretz, and P. Westfall, Simultaneous Inference in General Parametric Models, p.600

, Biom J, vol.50, pp.346-63, 2008.

S. Ireland and B. Turner, The effects of larval crowding and food type on the size and 602 development of the blowfly, Calliphora vomitoria, Forensic Science International, vol.603, pp.175-81, 2006.

L. Jehrke, F. A. Stewart, and A. Droste, The impact of genome variation and diet on the 605 metabolic phenotype and microbiome composition of Drosophila melanogaster

, Scientific Reports, vol.8, p.6215, 2018.

A. Joshi, J. Shiotsugu, and L. D. Mueller, Phenotypic enhancement of longevity by 608 environmental urea in Drosophila melanogaster, Experimental Gerontology, vol.609, pp.533-577, 1996.

P. Klepsatel, E. Procházka, and M. Gáliková, Crowding of Drosophila larvae affects lifespan 611 and other life-history traits via reduced availability of dietary yeast, Experimental 612 Gerontology, vol.110, pp.298-308, 2018.

M. Kolss, R. K. Vijendravarma, and G. Schwaller, Life-History Consequences of 614 Adaptation to Larval Nutritional Stress in Drosophila, Evolution, vol.63, pp.2389-615, 2009.

R. Lenth, H. Singmann, and J. Love, Emmeans: Estimated Marginal Means, Aka Least-617 Squares Means, 2020.

F. A. Lints and C. V. Lints, Influence of preimaginal environment on fecundity and ageing in 619 Drosophila melanogaster hybrids I. Preimaginal population density

, Experimental Gerontology, vol.4, pp.231-275, 1969.

T. Mago? and S. L. Salzberg, FLASH: fast length adjustment of short reads to improve 622 genome assemblies, Bioinformatics, vol.27, pp.2957-63, 2011.

M. E. Martino, P. Joncour, and R. Leenay, Bacterial Adaptation to the Host's Diet Is a Key 624 Evolutionary Force Shaping Drosophila-Lactobacillus Symbiosis, Cell Host & 625 Microbe, vol.24, pp.109-119, 2018.

V. G. Martinson, A. E. Douglas, and J. Jaenike, Community structure of the gut microbiota in 627 sympatric species of wild Drosophila, Ecology Letters, vol.20, pp.629-668, 2017.

R. C. Matos, M. Schwarzer, and H. Gervais, D-Alanylation of teichoic acids contributes to 629 Lactobacillus plantarum -mediated Drosophila growth during chronic 630 undernutrition, Nature Microbiology, vol.2, pp.1635-1682, 2017.

P. J. Mcmurdie, S. Holmes, and . Phyloseq, An R Package for Reproducible Interactive 632 Analysis and Graphics of Microbiome Census Data, PLOS ONE, vol.633, p.61217, 2013.

P. J. Mcmurdie, S. W. Holmes, and . Not, Want Not: Why Rarefying Microbiome Data Is 635 Inadmissible, PLOS Computational Biology, vol.10, p.1003531, 2014.

C. Mirth, J. W. Truman, and L. M. Riddiford, The Role of the Prothoracic Gland in Determining 637 Critical Weight for Metamorphosis in Drosophila melanogaster, Current Biology, vol.638, pp.1796-807, 2005.

N. N. Moghadam, M. Holmstrup, and T. Manenti, Phospholipid fatty acid composition 640 linking larval-density to lifespan of adult Drosophila melanogaster, Experimental, vol.641, pp.177-83, 2015.

P. D. Newell and A. E. Douglas, Interspecies Interactions Determine the Impact of the Gut 643 Microbiota on Nutrient Allocation in Drosophila melanogaster, Appl Environ 644 Microbiol, vol.80, pp.788-96, 2014.

L. Nunney, Drosophila on Oranges: Colonization, Competition, and Coexistence, Ecology, vol.71, pp.1904-1919, 1990.

M. J. O'donnell and A. Donini, Nitrogen Excretion and Metabolism in Insects. Acid-Base 648 Balance and Nitrogen Excretion in Invertebrates, pp.109-649, 2017.

I. S. Pais, R. S. Valente, and M. Sporniak, Drosophila melanogaster establishes a species-651 specific mutualistic interaction with stable gut-colonizing bacteria, PLOS Biology, vol.652, p.2005710, 2018.

C. J. Potrikus and J. A. Breznak, Gut bacteria recycle uric acid nitrogen in termites: A strategy 654 for nutrient conservation, Proc Natl Acad Sci U S A, vol.78, pp.4601-4606, 1981.

J. Ryu, S. Kim, and H. Lee, Innate Immune Homeostasis by the Homeobox Gene 656 Caudal and Commensal-Gut Mutualism in Drosophila, Science, vol.319, pp.777-657, 2008.

M. Sarangi, A. Nagarajan, and S. Dey, Evolution of increased larval competitive ability 659 in Drosophila melanogaster without increased larval feeding rate, J Genet, vol.660, pp.491-503, 2016.

Y. Y. Sautin and R. J. Johnson, Uric Acid: The Oxidant-Antioxidant Paradox. Nucleosides, 662 Nucleotides and Nucleic Acids, vol.27, pp.608-627, 2008.

J. F. Scheiring, D. G. Davis, and A. Banasinghe, Effects of larval crowding on life history 664 parameters in Drosophila melanogaster Meigen (Diptera:Drosophilidae)

, Entomological news, 1984.

V. N. Shenoi, S. Z. Ali, and N. G. Prasad, Evolution of increased adult longevity in Drosophila 667 melanogaster populations selected for adaptation to larval crowding, J Evol Biol, vol.668, pp.407-424, 2016.

S. C. Shin, S. Kim, and H. You, Drosophila microbiome modulates host developmental 670 and metabolic homeostasis via insulin signaling, Science, vol.334, pp.670-674, 2011.

J. Shiotsugu, A. M. Leroi, and H. Yashiro, The Symmetry of Correlated Selection 672 Responses in Adaptive Evolution: An Experimental Study Using Drosophila, Evolution, vol.51, pp.163-72, 1997.

Y. Soen, Environmental disruption of host-microbe co-adaptation as a potential driving 675 force in evolution, Front Genet, vol.5, 2014.

M. B. Sokolowski, H. S. Pereira, and K. Hughes, Evolution of foraging behavior in Drosophila 677 by density-dependent selection, PNAS, vol.94, pp.7373-7380, 1997.

J. G. Sørensen and V. Loeschcke, Larval crowding in Drosophila melanogaster induces 679 Hsp70 expression, and leads to increased adult longevity and adult thermal 680 stress resistance, Journal of Insect Physiology, vol.47, pp.1301-1308, 2001.

J. A. Stamps, L. H. Yang, and V. M. Morales, Drosophila Regulate Yeast Density and 682 Increase Yeast Community Similarity in a Natural Substrate, PLOS ONE, vol.683, p.42238, 2012.

F. Staubach, J. F. Baines, and S. Künzel, Host Species and Environmental Effects on 685 Bacterial Communities Associated with Drosophila in the Laboratory and in the 686 Natural Environment, PLOS ONE, vol.8, p.70749, 2013.

G. Storelli, A. Defaye, and B. Erkosar, Lactobacillus plantarum promotes Drosophila 688 systemic growth by modulating hormonal signals through TOR-dependent 689 nutrient sensing, Cell Metab, vol.14, pp.403-417, 2011.

M. A. Téfit, B. Gillet, and P. Joncour, Stable association of a Drosophila-derived 691 microbiota with its animal partner and the nutritional environment throughout a 692 fly population's life cycle, Journal of Insect Physiology, vol.106, pp.2-12, 2018.

L. Teixeira, Á. Ferreira, and M. Ashburner, The Bacterial Symbiont Wolbachia Induces 694 Resistance to RNA Viral Infections in Drosophila melanogaster, PLOS Biology, vol.695, p.1000002, 2008.

R. K. Vijendravarma, S. Narasimha, and T. J. Kawecki, Evolution of foraging behaviour in 697 response to chronic malnutrition in Drosophila melanogaster, Proceedings of 698 the Royal Society of, vol.279, pp.3540-3546, 2012.

N. Vodovar, M. Vinals, and P. Liehl, Drosophila host defense after oral infection by an 700 entomopathogenic Pseudomonas species, PNAS, vol.102, pp.11414-11423, 2005.

L. L. Wallrath, J. B. Burnett, and T. B. Friedman, Molecular characterization of the Drosophila 702 melanogaster urate oxidase gene, an ecdysone-repressible gene expressed 703 only in the malpighian tubules, Mol Cell Biol, vol.10, pp.5114-5141, 1990.

D. Weihrauch, A. Donini, O. Donnell, and M. J. , Ammonia transport by terrestrial and aquatic 705 insects, Journal of Insect Physiology, vol.58, pp.473-87, 2012.

B. Wertheim, J. Marchais, and L. Vet, Allee effect in larval resource exploitation in 707 Drosophila: an interaction among density of adults, larvae, and micro-708 organisms, Ecological Entomology, vol.27, pp.608-625, 2002.

N. J. Winans, A. Walter, and B. Chouaia, A genomic investigation of ecological 710 differentiation between free-living and Drosophila-associated bacteria

, Molecular Ecology, vol.26, pp.4536-50, 2017.

A. Wong, A. J. Dobson, and A. E. Douglas, Gut microbiota dictates the metabolic response 713 of Drosophila to diet, Journal of Experimental Biology, vol.217, pp.1894-901, 2014.

A. Wong, Y. Luo, and X. Jing, The Host as the Driver of the Microbiota in the Gut 715 and External Environment of Drosophila melanogaster, Appl Environ Microbiol, vol.716, pp.6232-6272, 2015.

R. Yamada, S. A. Deshpande, and K. D. Bruce, Microbes Promote Amino Acid Harvest to 718 Rescue Undernutrition in Drosophila, Cell Reports, vol.10, pp.865-72, 2015.

, Red error 5 bars: 95% confidence intervals around the prediction. Different letters indicate non-6 overlapping confidence intervals. (B) Viability from egg to pupae (red) and from egg to 7 adult (blue) as a function of larval density. Dots: mean viability per culture vial. Lines: 8 predictions from binomial GLM. Shaded areas: 95% confidence intervals around 9 predictions. (C) Fresh and dry masses of female and male adult individuals as a 10 function of larval density (N=30 per sex per density). Dots: individual mass 11 measurements. Lines: predictions from NLS model. Horizontal dashed lines: 12 stabilization threshold of mass calculated from model proprieties. (D) Pupation height 13 as a function of larval density. Dots: mean pupation height per vial. Red line and dots: 14 prediction from NLS model. (E) and (F) Boxplots of ammonia (N=10 per sample type 15 per density) and uric acid (N=8 per sample type per density) concentrations, in larvae 16 and food samples from LD, MD and HD conditions. Boxes: first and third quartiles of 17 the distribution

, Figure 2: Bacterial community variations in D. melanogaster larvae and in its 20 environment, at increasing population densities. (A) and (B) Boxplots of observed 26 food). Dots: sequencing replicates, colored by rearing density. Ellipses represent 95% 27 confidence zones. (D) Stacked barplot of sequenced OTU

, Effects of artificial supplementation of metabolic wastes on development and 30 pupating behavior in D. melanogaster. (A) Development time to adulthood in control 31 flies and in the three supplementation treatments. Dots: individual adult emergence 32 events, Figure, vol.3

, Dots: mean viability per vial 34 (N=6). (C) Pupation height. Dots: individual pupation heights. For all plots, boxes: first 35 and third quartiles of the distribution

, Larva is metabolizing nutrients, producing uric acid in the 39 process. Larva then degrades uric acid into intermediate products and finally to 40 ammonia or urea through the uricolytic pathway before defecating in the food. (B) Larva 41 is metabolizing nutrients, Conceptual visualization of hypothetical nitrogen cycle in the lab D. 38 melanogaster system. (A), vol.4