Space is not very far away. Aircraft on long-haul flights travel at a height of about 10 km. The lowest layer of the atmosphere, the Troposphere, ends at about 15 km. The air in the layers above the troposphere is very thin indeed. Think of a place around 15 km (9 miles) from where you are. That's pretty much how near you are to space. All the waste gases people dump into the air are trapped in the thin layer of air around the Earth.
Molecules in the air include nitrogen and oxygen as well as water, carbon dioxide, ozone, and many other compounds in trace amounts, some created naturally, others the result of human activity.
In addition to gases, the atmosphere contains extras such as smoke, dust, acid droplets, and pollen.
The stratosphere starts just above the troposphere and extends to 50 kilometres (31 miles) high. The ozone layer, which absorbs and scatters the solar ultraviolet radiation, is in this layer.
The mesosphere starts just above the stratosphere and extends to 85 kilometres (53 miles) high. Meteors burn up in this layer
The thermosphere starts just above the mesosphere and extends to 600 kilometres (372 miles) high. Aurora and satellites occur in this layer.
The ionosphere is an abundant layer of electrons and ionized atoms and molecules that stretches from about 48 kilometres (30 miles) above the surface to the edge of space at about 965 km (600 mi), overlapping into the mesosphere and thermosphere. This dynamic region grows and shrinks based on solar conditions and divides further into the sub-regions: D, E and F; based on what wavelength of solar radiation is absorbed. The ionosphere is a critical link in the chain of Sun-Earth interactions. This region is what makes radio communications possible.
This is the upper limit of our atmosphere. It extends from the top of the thermosphere up to 10,000 km (6,200 mi).