The percentage of oxygen in Earth's atmosphere varied between 10% and 35% throughout the Phanerozoic. These changes have been linked to the evolution, radiation, and size of animals but have not been considered to affect climate. We conducted simulations showing that modulation of the partial pressure of oxygen (pO2), as a result of its contribution to atmospheric mass and density, influences the optical depth of the atmosphere. Under low pO2 and a reduced-density atmosphere, shortwave scattering by air molecules and clouds is less frequent, leading to a substantial increase in surface shortwave forcing. Through feedbacks involving latent heat fluxes to the atmosphere and marine stratus clouds, surface shortwave forcing drives increases in atmospheric water vapor and global precipitation, enhances greenhouse forcing, and raises global surface temperature. Our results implicate pO2 as an important factor in climate forcing throughout geologic time.