The decisions that animals must make to achieve a balance between quantity and quality of resources become more difficult when their habitats are patchy and differ greatly in quality across space and time. Koalas are a prime subject to study this problem because they have a specialised diet of eucalypt leaves and need to balance nutrient and water intake against toxins in the leaves, all of which can change with soil type and climate. Koalas are nocturnal and spend most of the day resting and therefore choose trees for reasons other than feeding, particularly for thermoregulation. We GPS-tracked 40 koalas over 3 yr to determine their shift in tree selection between day and night, and in relation to daily maximum temperature, in a patchy rural landscape in north-western NSW, Australia. The species, degree of shelter, diameter, height and elevation of each visited tree were recorded. We used generalised linear mixed effects models to compare tree use between day and night and maximum daily temperature. Koalas used more feed-trees during the night, and more shelter-trees during the day. They also selected taller trees with more shelter in the day compared with night. As daytime temperatures rose, koalas increasingly selected taller trees at lower elevations. Our results demonstrate that koalas need taller trees, and non-feed species with shadier/denser foliage, to provide shelter from heat. This highlights the need both for the retention of taller, mature trees, such as remnant paddock trees, and the planting of both food and shelter trees to increase habitat area and connectivity across the landscape for arboreal species. Retaining and planting trees that provide optimum habitat will help arboreal folivores cope with the more frequent droughts and heatwaves expected with climate change.