Why there is always cold at high altitudes. e.g. at peak of mountains. Also as we go high from see level, temperature starts decreasing, so why is it.
I'd like to add to the answers already given. Indeed, the atmosphere is transparent to shortwave radiation from the Sun, but absorbs a lot of the longwave radiation from the Earth; that's why we have the greenhouse effect, that's why the Earths has a liveable climate and that's part of the reason why we have the lapse rate we observe. But why is it colder at the Tibetan plateau, which is a large, flat area at roughly 4 km elevation? Aren't we equally close to the local surface there as when we are at sea level?
Let's assume the Tibetan plateau receives the same intensity of solar radiation as lower areas at the same latitude. In reality, it probably receives more due to the dry climate. Then it should heat up more, shouldn't it? But it doesn't. The system Earth-Atmosphere can be considered to be in a local Radiative-Convective Equilibrium (see the diagram from Kevin Trenberth below). This means that the energy flows "in" and "out" cancel out by energy transport due to radiation and convection. In other words: what goes in, must go out (this is not really true locally, because there are large-scale flow patterns known as wind). Now, the Earth surface emits radiation according to its temperature with $P = \epsilon \sigma T^4$. Some of this radiation is aborbed by greenhouse gases (or clouds) in the atmosphere: water vapour, carbon dioxide, methane, and others. Then the atmosphere heats up, and again radiates according to $P = \epsilon \sigma T^4$; part of this radiation goes into space, and part goes back to the surface. The greenhouse gases keep the surface of the Earth warm like a blanket.
Now at the Tibetan plateau, the atmosphere is much less dense, because the elevation is so high. Therefore, radiation emitted by the surface is not absorbed much, but mostly exits straight into space. This means that the surface cools down. To return to the blanket analogy: Tibet has a much thinner blanket than lower elevations do.
Now I have made a number of severe simplifications, because in reality it depensd on day/night, on clouds, on atmospheric flow such as wind, on humidity, and on other factors. But whereas the explanation given by others explains why it gets colder higher up in the free atmosphere, I think it doesn't really explain why it is colder at the Tibetan plateau.
Crazy Buddy is quite correct that it's because gas expands and cools as it rises, but there is more to it than that.
For something to be be heated it must either absorb EM radiation, or it must be heated by some hot object it's in contact with. Air doesn't absorb light so it can't be directly heated by sunlight. Instead the sunlight passes through the air and heats the ground, and the ground heats the air.
The expansion comes in because the hot air that is heated by the ground rises. However as it rises it's volume increases and therefore it's temperature decreases. So the decrease in temperature with height is indeed due to expansion, but this is only the case because air is heated from below by the ground.
If air absorbed light directly it would heat up independantly of the ground and we would not see the same temperature variation with height. In fact exactly this effect happens in the stratosphere. In the upper reaches of the stratosphere ozone molecules absorb ultraviolet light and heat up, and in the stratosphere temperature increases with height instead of decreasing.
It's a consequence of Ideal gas law. For 'n' moles of gas, $PV=nRT$. As we go higher and higher, the atmospheric pressure decreases, causing the temperature to drop (since they're directly proportional...)
I got this one from Howstuffworks, which shows the variation of pressure with altitude in pounds per square inch. (PSI)
For more info, see Lapse Rate in Wiki. It also provides a good definition.
A natural question should've come by now, "Why does pressure decrease then..?"
Because the air molecules here at lower altitudes would experience the weight ($mg$) of the molecules above them thereby a net compressive force is produced. (seems a bit funny 'cause, how a molecule weighing some micro kg's would provide such a force?). Consider this way. They aren't weightless. They do have weight which is smaller. But, considering as a whole, the net weight is BIG. As altitude increases, the downward force also decreases due to the lower population of molecules.
Response to comment: Indeed, the number density ($n/V$) also influences temperature inversely (as suggested by @Prathyush) but its effect is quite a bit low, I think... Hence, neglecting such issues wouldn't be a problem as I'd say :-)
Gravity pulls air down closer towards lower altitudes. For this reason the atmospheric pressure is higher at lower altitudes. This higher pressure further results in a higher temperature as first described by Gay-Lussac's Law (Pressure is Proportional to temperature).