Animals move by adaptively coordinating the sequential activation of muscles. The circuit mechanisms underlying coordinated locomotion are poorly understood. Here, we report on a novel circuit for the propagation of waves of muscle contraction, using the peristaltic locomotion of Drosophila larvae as a model system. We found an intersegmental chain of synaptically connected neurons, alternating excitatory and inhibitory, necessary for wave propagation and active in phase with the wave. The excitatory neurons (A27h) are premotor and necessary only for forward locomotion, and are modulated by stretch receptors and descending inputs. The inhibitory neurons (GDL) are necessary for both forward and backward locomotion, suggestive of different yet coupled central pattern generators, and its inhibition is necessary for wave propagation. The circuit structure and functional imaging indicated that the commands to contract one segment promote the relaxation of the next segment, revealing a mechanism for wave propagation in peristaltic locomotion.