Ectotherms use behaviour to buffer effects of temperature on growth, development and survival. While behavioural thermoregulation is widely reported, localized adaptation of thermal preference is poorly documented. Larval amphibians live in wetlands ranging from entirely open to heavily shaded by vegetation. We hypothesized that populations undergo localized selection leading to countergradient patterns of thermal preference behaviour. Specifically, we predicted that wood frog (Rana sylvatica) larvae from closed canopy ponds would be more strongly temperature selective and would prefer higher temperatures than conspecifics from populations found in open canopy ponds. In a study of six breeding ponds in north-eastern Connecticut, USA, these predictions were upheld. The countergradient, microgeographical variation in thermal preference documented here implies that wood frog populations may have diverged rapidly in the face of contrasting selection pressures. Rapid, behaviourally mediated responses to changing thermal environments have important implications for understanding population responses to climate change.