Host–parasite coevolution can maintain high levels of genetic diversity in traits involved in species interactions. In many systems, host traits exploited by parasites are constrained by use in other functions, leading to complex selective pressures across space and time. Here, we study genome-wide variation in the staple crop Sorghum bicolor (L.) Moench and its association with the parasitic weed Striga hermonthica (Delile) Benth., a major constraint to food security in Africa. We hypothesize that geographic selection mosaics across gradients of parasite occurrence maintain genetic diversity in sorghum landrace resistance. Suggesting a role in local adaptation to parasite pressure, multiple independent loss-of-function alleles at sorghum LOW GERMINATION STIMULANT 1 (LGS1) are broadly distributed among African landraces and geographically associated with S. hermonthica occurrence. However, low frequency of these alleles within S. hermonthica-prone regions and their absence elsewhere implicate potential trade-offs restricting their fixation. LGS1 is thought to cause resistance by changing stereochemistry of strigolactones, hormones that control plant architecture and below-ground signaling to mycorrhizae and are required to stimulate parasite germination. Consistent with trade-offs, we find signatures of balancing selection surrounding LGS1 and other candidates from analysis of genome-wide associations with parasite distribution. Experiments with CRISPR–Cas9-edited sorghum further indicate that the benefit of LGS1-mediated resistance strongly depends on parasite genotype and abiotic environment and comes at the cost of reduced photosystem gene expression. Our study demonstrates long-term maintenance of diversity in host resistance genes across smallholder agroecosystems, providing a valuable comparison to both industrial farming systems and natural communities.