The sun provides a huge source of heat energy from the fusion reactions taking place on it’s surface and is the primary source of energy in our solar system. The closer you are to the sun, the closer in turn you are to the high levels of radiation the sun produces. The higher doses of radiation absorbed makes objects nearer to the sun warmer, as opposed to planets further away which absorb lower doses. Simply put, it is the same as being near a camp-fire where the further away you move from it the less heat you feel.
The only exception to this in our solar system is Venus which is actually warmer than Mercury, due to its extreme greenhouse effect as a result of its thick carbon dioxide atmosphere.
Comparing average temperatures of planets, you can see a significant decrease in temperature the further away the planet is from the Sun:
- Earth, the 3rd planet from the Sun, has an average temperature of 15°C
- Jupiter, the 5th planet from the Sun, has an average temperature of -130°C
- Neptune, the 8th planet from the Sun, has an average temperature of -200°C