Earth's atmosphere is composed primarily of nitrogen and oxygen. It surrounds the planet and provides gases necessary for life while trapping heat from the sun. Burning fossil fuels causes more air pollution than other natural sources. The layers of the atmosphere from Earth to space are the troposphere, stratosphere, mesosphere, and thermosphere. Weather occurs in the troposphere, while the stratosphere contains the ozone layer.