Recent studies have demonstrated high levels of genotypic and phenotypic variation in populations of parasites, even within individual hosts. Several genetic, immunological and epidemiological mechanisms have been postulated as promoters of such variation, but little empirical work has addressed the role of host ecology. A nucleopolyhedrovirus that attacks larvae of the pine beauty moth, Panolis flammea, exists as a complex mixture of genotypes within individual host larvae. We demonstrate that the food plant species eaten by the host (Scots pine vs. lodgepole pine) differentially affects the pathogenicity and productivity of two virus genotypes originally purified from a single host individual. We hypothesize that such food plant-mediated differential selection will promote genotypic variation between baculovirus populations, and that subsequent remixing of virus genotypes could maintain genotypic variation within individual hosts. Our results provide a tritrophic explanation for the genotypic and phenotypic complexity of host–parasite interactions with complex ecologies.