Overnutrition with dietary sugar can worsen infection outcomes in diverse organisms including insects and humans, through generally unknown mechanisms. In the present study, we show that adult Drosophila melanogaster fed high-sugar diets became more susceptible to infection by the Gram-negative bacteria Providencia rettgeri and Serratia marcescens. We found that P. rettgeri and S. marcescens proliferate more rapidly in D. melanogaster fed a high-sugar diet, resulting in increased probability of host death. D. melanogaster become hyperglycemic on the high-sugar diet, and we find evidence that the extra carbon availability may promote S. marcescens growth within the host. However, we found no evidence that increased carbon availability directly supports greater P. rettgeri growth. D. melanogaster on both diets fully induce transcription of antimicrobial peptide (AMP) genes in response to infection, but D. melanogaster provided with high-sugar diets show reduced production of AMP protein. Thus, overnutrition with dietary sugar may impair host immunity at the level of AMP translation. Our results demonstrate that dietary sugar can shape infection dynamics by impacting both host and pathogen, depending on the nutritional requirements of the pathogen and by altering the physiological capacity of the host to sustain an immune response.