Innate behaviours are flexible: they change rapidly in response to transient environmental conditions, and are modified slowly by changes in the genome. A classical flexible behaviour is the exploration-exploitation decision, which describes the time at which foraging animals choose to abandon a depleting food supply. We have used quantitative genetic analysis to examine the decision to leave a food patch in Caenorhabditis elegans. Here we show that patch-leaving is a multigenic trait regulated in part by naturally occurring non-coding polymorphisms in tyra-3 (tyramine receptor 3), which encodes a G-protein-coupled catecholamine receptor related to vertebrate adrenergic receptors. tyra-3 acts in sensory neurons that detect environmental cues, suggesting that the internal catecholamines detected by tyra-3 regulate responses to external conditions. These results indicate that genetic variation and environmental cues converge on common circuits to regulate behaviour, and suggest that catecholamines have an ancient role in regulating behavioural decisions.