When altitude increases, number of gas molecules will be decreased. Therefore, the density is also decreased when we go higher. Gravity pulls most of the atmosphere’s gas molecules close to the Earth’s surface. Air rises as it is heated because it becomes less dense.