Many ectotherms spend long periods in retreat-sites, where thermal conditions may strongly influence key physiological or behavioural processes (e.g. locomotion, digestion, growth rates etc). Species that rely upon specific thermal regimes may be restricted to particular types of retreat-sites, and hence vulnerable to anthropogenic habitat disturbance. We investigated the role of thermal factors in retreat-site selection by an endangered snake species: the broad-headed snake, Hoplocephalus bungaroides. Broad-headed snakes are restricted to sandstone rock outcrops where exfoliated boulders of different sizes and thicknesses provide a suite of retreat-sites with unique thermal characteristics. Body temperatures of snakes sheltering under rocks are determined by the degree of shading and the thickness of the rock. In the laboratory, broad-headed snakes select temperatures around 30°C, and strike speed is maximised at this temperature. From these data, we predicted seasonal patterns of habitat use by the snakes, by assuming that snakes would select retreat-sites with temperatures within their `preferred' body temperature range. Radiotelemetric monitoring of 25 adult snakes (total of 33 snake-seasons of data) and mark–recapture data from 96 tagged snakes (including 56 juveniles) supported our predictions. During spring, snakes actively selected thin (≤15 cm thick) unshaded rocks. These `hot' rocks allowed snakes to attain body temperatures within their set-point range for long periods of time. The snakes rarely moved between rocks, and a small number of rocks received frequent use by snakes of all sizes. Telemetered snakes also used cliff-top crevices exposed to the afternoon sun (i.e. with north or westerly aspects) and avoided cooler crevices (those with easterly and southerly aspects). During summer, snakes avoided thin exposed rocks which became too hot for them to tolerate (often, >40°C). Although some snakes moved to thicker and more shaded rocks, most snakes abandoned the rock outcrops and moved into adjacent woodland. The seasonal timing of this habitat shift varied among years, but coincided with the onset of hot weather. Thus, simple measurements of the thermal characteristics of snake retreat-sites allowed us to successfully predict major patterns of habitat use, and provide a basis from which to plan the protection and/or restoration of critical habitat components for this endangered species.