The extent of damage to crop plants from pest insects depends on the foraging behaviour of the insect's feeding stage. Little is known, however, about the genetic and molecular bases of foraging behaviour in phytophagous pest insects. The foraging gene (for), a candidate gene encoding a PKG-I, has an evolutionarily conserved function in feeding strategies. Until now, for had never been studied in Lepidoptera, which includes major pest species. The cereal stem borer Sesamia nonagrioides is therefore a relevant species within this order with which to study conservation of and polymorphism in the for gene, and its role in foraging -a behavioural trait that is directly associated with plant injuries. Full sequencing of for cDNA in S. nonagrioides revealed a high degree of conservation with other insect taxa. Activation of PKG by a cGMP analogue increased larval foraging activity, measured by how frequently larvae moved between food patches in an actimeter. We found one non-synonymous allelic variation in a natural population that defined two allelic variants. These variants presented significantly different levels of foraging activity, and the behaviour was positively correlated to gene expression levels. Our results show that for gene function is conserved in this species of Lepidoptera, and describe an original case of a single nucleotide polymorphism associated with foraging behaviour variation in a pest insect. By illustrating how variation in this single gene can predict phenotype, this work opens new perspectives into the evolutionary context of insect adaptation to plants, as well as pest management.