Although glucose-sensing neurons were identified more than 50 years ago, the physiological role of glucose sensing in metazoans remains unclear. Here we identify a pair of glucose-sensing neurons with bifurcated axons in the brain of Drosophila. One axon branch projects to insulin-producing cells to trigger the release of Drosophila insulin-like peptide 2 (dilp2) and the other extends to adipokinetic hormone (AKH)–producing cells to inhibit secretion of AKH, the fly analogue of glucagon. These axonal branches undergo synaptic remodelling in response to changes in their internal energy status. Silencing of these glucose-sensing neurons largely disabled the response of insulin-producing cells to glucose and dilp2 secretion, disinhibited AKH secretion in corpora cardiaca and caused hyperglycaemia, a hallmark feature of diabetes mellitus. We propose that these glucose-sensing neurons maintain glucose homeostasis by promoting the secretion of dilp2 and suppressing the release of AKH when haemolymph glucose levels are high.