Cooperatively breeding species exhibit a range of social behaviours associated with different costs and benefits to group living, often in association with different environmental conditions. For example, recent phylogenetic studies have collectively shown that the evolution and distribution of cooperative breeding behaviour is related to the environment. However, little is known about how environmental variation may drive differences in social systems across populations within species, and how the relationship between environmental conditions and sociality may differ across species. Here, we examine variation in social group size along a steep environmental gradient for two congeneric cooperatively breeding species of fairywrens (Maluridae) and show that they exhibit opposing ecogeographic patterns. Purple-backed fairywrens, a species in which helpers increase group productivity, have larger groups in hot, dry environments and smaller groups in cool, wet environments. By contrast, superb fairywrens, a species with helpers that do not increase group productivity despite the presence of alloparental care, exhibit the opposite trend. We suggest differences in the costs and benefits of sociality contribute to these opposing ecogeographical patterns and demonstrate that comparisons of intraspecific patterns of social variation across species can provide insight into how ecology shapes social systems.