It seems like the lack of atmosphere should not be playing a role in the diurnal temperature variation because that's what makes it colder. Mountains are not that dry, usually.
The answer is in the EM absorption/emission profile of the atmosphere with height. Visible wavelengths pass through the atmosphere unheeded, except for clouds. IR is somewhat absorbed by carbon dioxide. That same carbon dioxide emits IR radiation too, allowing it to cool. Atmospheric parcels at higher elevations have less intervening carbon dioxide between them and cold black space. This means faster cooling, but the effect is not very strong.
At very high altitudes, a different process dominates. UV light is absorbed high in the atmosphere. Although there is much less UV light from the sun than visible light, the part of the atmosphere effected is very low density, so that UV can have a large effect.
Even further up, X-rays and solar wind charged particles cause ionization and a huge amount of heating. Charged particles interact at the magnetic poles (auroras). X-rays and hard UV hit the day side, cause a big diurnal perturbation.