In the troposphere, temperatures decrease with altitude.
Above the troposphere, in the stratosphere, temperatures increase with altitude.
Above the stratosphere, in the mesosphere, temperatures again decrease with altitude.
And above the mesosphere, in the thermosphere, temperatures again increase with altitude
to where individual molecules become very hot but are so widely scattered that you wouldn’t feel their heat.
See also in The book of science:
Readings in wikipedia: