Both humans and animals seek primary rewards in the environment, even when such rewards do not correspond to current physiological needs. An example of this is a dissociation between food-seeking behaviour and metabolic needs, a notoriously difficult-to-treat symptom of eating disorders. Feeding relies on distinct cell groups in the hypothalamus1,2,3,4, the activity of which also changes in anticipation of feeding onset5,6,7. The hypothalamus receives strong descending inputs from the lateral septum, which is connected, in turn, with cortical networks8, but cognitive regulation of feeding-related behaviours is not yet understood. Cortical cognitive processing9,10involves gamma oscillations11,12,13,14,15, which support memory16,17, attention18, cognitive flexibility19and sensory responses20. These functions contribute crucially to feeding behaviour by unknown neural mechanisms. Here we show that coordinated gamma (30–90 Hz) oscillations in the lateral hypothalamus and upstream brain regions organize food-seeking behaviour in mice. Gamma-rhythmic input to the lateral hypothalamus from somatostatin-positive lateral septum cells evokes food approach without affecting food intake. Inhibitory inputs from the lateral septum enable separate signalling by lateral hypothalamus neurons according to their feeding-related activity, making them fire at distinct phases of the gamma oscillation. Upstream, medial prefrontal cortical projections provide gamma-rhythmic inputs to the lateral septum; these inputs are causally associated with improved performance in a food-rewarded learning task. Overall, our work identifies a top-down pathway that uses gamma synchronization to guide the activity of subcortical networks and to regulate feeding behaviour by dynamic reorganization of functional cell groups in the hypothalamus.