How the body interacts with the brain to perform vital life functions, such as feeding, is a fundamental issue in physiology and neuroscience. Here, we use a whole-animal scanning transmission electron microscopy volume of Drosophila to map the neuronal circuits that connect the entire enteric nervous system to the brain via the insect vagus nerve at synaptic resolution. We identify a gut-brain feedback loop in which Piezo-expressing mechanosensory neurons in the esophagus convey food passage information to a cluster of six serotonergic neurons in the brain. Together with information on food value, these central serotonergic neurons enhance the activity of serotonin receptor 7-expressing motor neurons that drive swallowing. This elemental circuit architecture includes an axo-axonic synaptic connection from the glutamatergic motor neurons innervating the esophageal muscles onto the mechanosensory neurons that signal to the serotonergic neurons. Our analysis elucidates a neuromodulatory sensory-motor system in which ongoing motor activity is strengthened through serotonin upon completion of a biologically meaningful action, and it may represent an ancient form of motor learning.