Animal behavior is organized into nested temporal patterns spanning multiple timescales. This behavior hierarchy is believed to arise from a hierarchical neural architecture: neurons near the top of the hierarchy are involved in planning, selecting, initiating, and maintaining motor programs while those near the bottom of the hierarchy act in concert to produce fine spatiotemporal motor activity. InCaenorhabditis elegans, behavior on a long timescale emerges from ordered and flexible transitions between different behavioral states, such as forward movement, reversal, and turn. On a short timescale, different parts of the animal body coordinate fast rhythmic bending sequences to produce directional movements. Here, we show SAA, a class of interneurons that enable cross-communication between dorsal and ventral head motor neurons, play a dual role in shaping behavioral dynamics on different timescales. On the short timescale, SAA regulate and stabilize rhythmic bending activity during forward movements. On the long timescale, the same neurons suppress spontaneous reversals and facilitates reversal termination by inhibiting RIM, an integrating neuron that helps sustain a behavioral state. These results suggest that feedback from a lower-level cell assembly to a higher-level command center is essential for bridging behavioral dynamics at different levels.