Venus is the hottest planet even though Mercury is the closest planet to the Sun. The reason that Venus is hotter than Mercury is that it has an atmosphere made of carbon dioxide; it also has clouds of acid inside its atmosphere.
Thus the sunlight gets trapped by these gases giving rise to the greenhouse effect.
The greenhouse effect increases the temperature of Venus making it the hottest planet in the solar system.