Question: how much does air expand with altitude?
Answer: As the pressure decreases with altitude, the parcel of air expands against the reduced external pressure. It does work in doing so, which reduces its internal energy, the average energy of its constituent molecules. The definition of temperature is molecular kinetic energy. When this is lower, temperature is lower.