Vertical Temperature Structure of the Atmosphere
 
The portion of the atmosphere that contains the majority of the Earth's weather is the troposphere. Here, thunderstorms and clouds bubble up from the surface and extratropical cyclones dominate the weather in the mid-latitudes. But a jet airliner cruises at the bottom of the stratosphere - the next layer of the atmosphere above the troposphere. The troposphere is closest to the surface, followed by the stratosphere, mesosphere and the thermosphere. 
 
Schematic displaying the vertical temperature profile of the atmosphere. 
From: http://www.geog.ucsb.edu/~joel/g110_w08/lecture_notes/atmosphere/atmosphere.html
Within the troposphere, the temperature decreases linearly with height. This is because, much like a frying pan, it is heated from the ground upwards. As a result, the troposphere is inherently unstable and the air close to the surface wants to rise. As it does so, the volume of the air must increase in order for its pressure to decrease. This increase in volume is associated with a decrease in temperature (as a result of the ideal gas law) - explaining why the temperature decreases with height. 
 
The intersection between the troposphere and stratosphere is called the tropopause. In the stratosphere, the temperature increases with height - this is due to the production of heat in the process of the formation of ozone. The positioning of warmer air over colder air here is called a temperature inversion. Its effects are most obvious by the formation of anvil tops in cumulonimbis clouds, as the inversion prevents convection at the top of the troposphere. 
 
The stratopause denotes the beginning of the mesosphere. Temperatures in the mesosphere decrease with height once again because the concentration of ozone drops off, and carbon dioxide in this layer helps to radiate heat back into space, cooling the entire layer. 
 
At the top of the mesosphere is the mesopause: above this is the thermosphere, the layer in which space begins. Temperatures here increase rapidly with height. This is because high energy ultraviolet and x-ray radiation from the Sun is absorbed by the molecules in this layer. This energy excites the molecules, resulting in a large temperature increase. The atmosphere here would still feel very cold against the skin because of the extremely low density of the air. Although the molecules have a high temperature, there are not enough of them to heat our skin. This layer contains both the hottest and coldest parts of the atmosphere: the bottom of the thermosphere can be as low as -120°C while the top can reach as high as 2000°C.