Relative to morphological traits, we know little about how genetics influence the evolution of complex behavioural differences in nature. It is unclear how the environment influences natural variation in heritable behaviour, and whether complex behavioural differences evolve through few genetic changes, each affecting many aspects of behaviour, or through the accumulation of several genetic changes that, when combined, give rise to behavioural complexity. Here we show that in nature, oldfield mice (Peromyscus polionotus) build complex burrows with long entrance and escape tunnels, and that burrow length is consistent across populations, although burrow depth varies with soil composition. This burrow architecture is in contrast with the small, simple burrows of its sister species, deer mice (P. maniculatus). When investigated under laboratory conditions, both species recapitulate their natural burrowing behaviour. Genetic crosses between the two species reveal that the derived burrows of oldfield mice are dominant and evolved through the addition of multiple genetic changes. In burrows built by first-generation backcross mice, entrance-tunnel length and the presence of an escape tunnel can be uncoupled, suggesting that these traits are modular. Quantitative trait locus analysis also indicates that tunnel length segregates as a complex trait, affected by at least three independent genetic regions, whereas the presence of an escape tunnel is associated with only a single locus. Together, these results suggest that complex behaviours--in this case, a classic 'extended phenotype'--can evolve through multiple genetic changes each affecting distinct behaviour modules.