  Since the formation of the terrestrial planets, atmospheric loss has
irreversibly altered their atmospheres, leading to remarkably different surface
environments - Earth has remained habitable while Venus and Mars are apparently
desolate. The concept of habitability centres around the availability of liquid
water which depends greatly on the composition of the atmosphere. While the
history of molecular oxygen O$_2$ in Earth's atmosphere is debated, geological
evidence supports at least two major episodes of increasing oxygenation: the
Great Oxidation Event and the Neoproterozoic Oxidation Event. Both are thought
to have been pivotal for the development and evolution of life. We demonstrate
through three-dimensional simulations that atmospheric O$_2$ concentrations on
Earth directly control the evolution and distribution of greenhouse gases (such
as O$_3$, H$_2$O, CH$_4$ and CO$_2$) and the atmospheric temperature structure.
In particular, at $\leq 1$% the present atmospheric level (PAL) of O$_2$, the
stratosphere collapses. Our simulations show that a biologically ineffective
ozone shield, lower than previously thought, existed during the Proterozoic,
with a need for a Phanerozoic ozone shield to allow the emergence of surface
life. We find that O$_2$ acts as a valve for the loss rate of atmospheric
hydrogen through the exosphere. Estimated levels of hydrogen escape for the
Proterozoic eon are all lower than present day, enabling us to establish
Earth's water loss timeline. Furthermore, we demonstrate how O$_2$ on
terrestrial exoplanets determines their theoretical transmission spectra,
challenging signal-to-nose ratio assumptions contributing to the design of next
generation telescopes that will facilitate the characterisation of Earth-like
worlds.
