Ambient temperatures are rising globally, with the greatest increases recorded at night. Concurrently, the prevalence of insufficient sleep is increasing in many populations, with substantial costs to human health and well-being. Even though nearly a third of the human lifespan is spent asleep, it remains unknown whether temperature and weather impact objective measures of sleep in real-world settings, globally. Here we link billions of sleep measurements from wearable devices comprising over 7 million nighttime sleep records across 68 countries to local daily meteorological data from 2015 to 2017. Rising nighttime temperatures shorten within-person sleep duration primarily through delayed onset, increasing the probability of insufficient sleep. The effect of temperature on sleep loss is substantially larger for residents from lower income countries and older adults, and females are affected more than are males. Nighttime temperature increases inflict the greatest sleep loss during summer and fall months, and we do not find evidence of short-term acclimatization. Coupling historical behavioral measurements with output from climate models, we project that climate change will further erode human sleep, producing substantial geographic inequalities. Our findings have significant implications for adaptation planning and illuminate a pathway through which rising temperatures may globally impact public health.