Sociality has evolved independently many times in a diverse array of animal taxa. While sociality in some invertebrates, birds and mammals is relatively well understood, complex social behaviour in Squamate reptiles is a comparatively recent discovery. The extent to which social behaviour is phylogenetically constrained, or free to respond to environmental conditions is a key question in understanding sociality. We sampled 74 aggregations involving 137 individuals of a social lizard (Egernia stokesii) from 13 sites across a 96 250 km 2 area showing a wide range of environmental conditions. Over all locations, 70% of the lizards were found in aggregations, supporting the previous suggestion that aggregation in this species is phylogenetically constrained. However, the size of aggregations was negatively related to spatial variation in aridity and daily variation in maximum temperature, suggesting that social behaviour also varied in response to harsh environmental conditions. Lizards aggregated more in arid areas and on cold days. Our results show that it is overly simplistic to regard social behaviour in E. stokesii as either phylogenetically constrained or environmentally determined. A more nuanced appreciation of the extent to which social behaviour is free to vary in response to environmental conditions improves our understanding of social behaviour in Squamate reptiles.