Ambient temperatures are rising worldwide, with the greatest increases recorded at night. Concurrently, the prevalence of insufficient sleep is rising in many populations. Yet it remains unclear whether warmer-than-average temperatures causally impact objective measures of sleep globally. Here, we link billions of repeated sleep measurements from sleep-tracking wristbands comprising over 7 million sleep records (n = 47,628) across 68 countries to local daily meteorological data. Controlling for individual, seasonal, and time-varying confounds, increased temperature shortens sleep primarily through delayed onset, increasing the probability of insufficient sleep. The temperature effect on sleep loss is substantially larger for residents from lower-income countries and older adults, and females are affected more than males. Those in hotter regions experience comparably more sleep loss per degree of warming, suggesting limited adaptation. By 2099, suboptimal temperatures may erode 50-58 h of sleep per person-year, with climate change producing geographic inequalities that scale with future emissions.