Preterm infants are susceptible to bloodstream infection that can lead to sepsis. High parenteral glucose supplement is commonly used to support their growth and energy expenditure, but may exceed endogenous regulation during infection, causing dysregulated immune response and clinical deterioration. Using a preterm piglet model of neonatal sepsis induced by Staphylococcus epidermidis infection, we demonstrate the delicate interplay between immunity and energy metabolism to regulate the host infection response. Circulating glucose levels, glycolysis and inflammatory response to infection are closely connected across the states of tolerance, resistance and immunoparalysis. Further, high parenteral glucose provision during infection induces hyperglycemia, elevated glycolysis and inflammation, leading to lactate acidosis and sepsis, whereas glucose restricted individuals are clinically unaffected with increased gluconeogenesis to maintain moderate hypoglycemia. Finally, pharmacological glycolysis inhibition during normoglycemia enhances bacterial clearance and dampens inflammation but fails to prevent sepsis. Our results uncover how blood glucose controls immune cell metabolism and function, in turn determining the clinical fate of infected preterm neonates. This also questions the current practice of parenteral glucose supply for infected preterm infants.