The higher up you go the farther apart air molecules are, few molecules means that higher elevations are colder because there are fewer particles to trap heat. Air molecules are held together by gravity. The higher up they are, the harder it is for gravity to hold them together. At higher elevations, air molecules are spaced farther apart, meaning the air is less dense. The air is less able to trap heat from the Sun, so temperatures are cooler. At lower elevations, air molecules are closer together, meaning the air is more dense. The air is better able to trap heat, so temperatures are warmer.