Why is air at high altitude less dense?

Air at any altitude is compressed by the weight of the air above it. At higher altitudes there is less air weighing down form above, so there is less compression.