The intestinal microbiota regulates various biological functions such as communication between the gut and the nervous system, though the mechanistic details are incomplete. Now, Schretter et al. find a role for the microbiota in coordinated locomotion in the fruit fly Drosophila melanogaster, first showing that adult female flies lacking commensal bacteria exhibited increased walking speeds and daily activity. Introduction of one of the two dominant resident species, Lactobacillus brevis, or a cell-free supernatant of these bacteria restored the temporal patterns of locomotion to that of conventionally raised flies. A combination of biochemical analysis of these supernatants, a screen of a mutant Escherichia coli strain library, and rescue and deletion experiments identified xylose isomerase (Xi) as a determinant of the L. brevis–mediated locomotor effects. Supplementation of flies with Xi substrates and products identified trehalose as mediating the locomotor effects of Xi, while activation of individual neuronal populations implicated signaling pathways downstream of the neurotransmitter octopamine. These results point to specific microbiota products in regulating D. melanogaster octopaminergic pathways to modulate locomotion.