Air is retained on the surface of the Earth due to gravity. At sea level the air is dense and compressed to a breathable level by all the layers of the atmosphere above it. As you go further up there is less pressure pushing down the air, therefore less oxygen is available. Climbers on Everest acclimatise to the lack of oxygen by spending days and even weeks at around 7,925 metres (26,000 feet) in an area called the Death Zone. Once their bodies are used to the low levels of oxygen content in the air they can climb the final 914 metres (3,000 feet) or so to the summit.
Plus, take a look at: