Extreme weather events radically alter ecosystems. When ecological damage persists, selective pressures on individuals can change, leading to phenotypic adjustments. For group-living animals, social relationships may be a mechanism enabling adaptation to ecosystem disturbance. Yet whether such events alter selection on sociality and whether group-living animals can, as a result, adaptively change their social relationships remain untested. We leveraged 10 years of data collected on rhesus macaques before and after a category 4 hurricane caused persistent deforestation, exacerbating monkeys' exposure to intense heat. In response, macaques demonstrated persistently increased tolerance and decreased aggression toward other monkeys, facilitating access to scarce shade critical for thermoregulation. Social tolerance predicted individual survival after the hurricane, but not before it, revealing a shift in the adaptive function of sociality.