We know that due to buoyancy the cold air sinks and warm air floats above it due to it being less dense than cold air. Then why do we feel cold as we go to greater heights/hill stations and feel hot when we are in the normal surface of earth?
This is because the air pressure changes significantly with height, and compression or expansion of a gas causes it to warm or cool. In a convective atmosphere, temperature differences cause air to rise in some places and descend in others. When it rises, it expands, and that causes it to cool. When air descends, it is compressed, and that causes it to warm.
(The compressive warming/cooling of gases is also why a bicycle tyre air pump gets hot when you use it, and how a refrigerator works.)
This warming and cooling effect stabilises the atmosphere against heat rising. If the rate of temperature change with height is less than a particular value called the adiabatic lapse rate (ALR), then the atmosphere is stable and warm air won't rise. ('Adiabatic' means that we assume there is no heat gained or lost from an air packet by radiation or conduction.) If the gradient exceeds the adiabatic lapse rate, then convection suddenly starts up again, the heat rises and reduces the gradient back down until, usually in a matter of minutes to a few hours, it once again equals the adiabatic lapse rate.
The adiabatic lapse rate in dry air is about $9.8$ K/km, so for every $1$ km you rise, the temperature drops $1$ K (= $1^\circ$C). However, in the presence of water vapour, there is an additional heating and cooling effect from the condensation or evaporation of water droplets (latent heat of condensation). This reduces the lapse rate down to around $6.5$ K/km, called the moist adiabatic lapse rate (MALR). This is the value the International Standard Atmosphere assumes for aviation purposes, and is generally a pretty accurate approximation, but there are variations from it depending on humidity and weather conditions. (In particular, at night or in the polar winters you can get temperature inversions when surface heating stops and cold air pools near the surface.)
This has lots of applications in meteorology. For example, the adiabatic lapse rate is a major part of the mechanism of the greenhouse effect. The planet as a whole absorbs energy from sunlight, and then re-radiates all that energy back into outer space as black body radiation in the infrared part of the spectrum. The black body temperature needed to balance input and output is about $-20^\circ$C, and this is the average temperature the Earth's surface would be without the greenhouse effect. When the atmosphere contains gases opaque to infrared (mostly water vapour, but also CO$_2$ and others), the 'surface' of the Earth radiating to space is high up in the atmosphere, at about 5 km altitude on average. This is the level that settles at $-20^\circ$C, and the solid surface down on the ground where we live is about $6.5$ C/km $\times 5$ km $= 32.5^\circ$C warmer. The circulating air is warmed above $-20^\circ$C by being compressed by increasing air pressure as it descends from this level. Adiabatic compression is the actual mechanism by which the air warms in the greenhouse effect. More greenhouse gases like water vapour would raise the altitude of IR emission to space, giving rise to more altitude-based warming. On the other hand, more water vapour would reduce the MALR, leading to less warming (and also predicts a 'hot spot' above the 5 km level in the tropics). It's complicated.
The same mechanism also explains the very hot temperatures on the surface of Venus. The cloud layer there reflects much more sunlight than Earth does, so Venus as a whole actually absorbs less energy from the sun than Earth. Very little light penetrates the thick clouds, so the surface is even darker. But the cloud tops are at an altitude of about 50-80 km on Venus, compared to 5 km on Earth, and so the warming due to compression as atmospheric gases descend 50-80 km into the crushing depths is hugely greater.
This is also the explanation for why we see no greenhouse effect in water. It, too, is transparent to visible light and opaque to infrared. Liquid water is about 20,000 times more powerful a greenhouse agent than the atmosphere! But it is nearly incompressible, so the adiabatic lapse rate is nearly zero, so convection instantly starts up to eliminate any warming at depth, and doesn't stop until it is entirely eliminated. (Strictly speaking, there is a non-zero lapse rate of about $0.2^\circ$C/km, which results in the ocean depths kilometres down being very slightly warmer. It's arguable that this is in fact an example of the 'greenhouse effect', even though it's pitch black and very cold down there!) If you artificially prevent convection in a shallow pool of water (a few metres deep), the bottom heats up to about $90^\circ$C, which has been used as an energy source in the solar pond.
The theory of convection - that hot air rises - is an approximation for the lab scale where altitudes don't vary much. $6.5^\circ$C/km is $0.0065^\circ$C/m, so the effect is nearly invisible when looking at hot air rising from a candle or a radiator in a room only 2-3 metres high. The adiabatic lapse rate only shows up when we look at things on a larger scale, of $100$ metres or more.
Suppose a very dilute atmosphere, so that the air molecules don't collide with each other. The gravity attraction accelerates all of them to the surface, where they bounce and go up again. The maximum velocity would be close to the earth surface, and it would be decreasing for higher altitudes as any other object.
Temperature of air is a macro propriety due to the kinetic energy of the molecules. So it is greater at low altitudes, and smaller at higher ones.
Our atmosphere is not so dilute and the collisions between molecules are common, but the idea is the same. For low altitudes there is high kinetic and low potential energy. For high altitudes the opposite is true.
The hot air rises in a bonfire for example, because it is less dense than the surrounding colder air. But it loses kinetic energy due to gravitational attraction as it rises, what is the same as to say: it loses temperature.