Venus is hotter than Mercury because it has a thicker atmosphere. Mercury, on the other hand, has a thin layer of atmosphere that does not allow it to keep the heat on the planet.
Venus's atmosphere is made up of Nitrogen, Carbon dioxide, and sulphuric acid. According to NASA, Venus composes of 96% carbon dioxide which enables it to keep the heat. Mercury has very little carbon dioxide. The thick layer of carbon dioxide acts as a blanket, greenhouse effect. Carbon Dioxide absorbs the heat Venus tries to produce at night and instead keeps it to itself. This makes the planet to have a high surface temperature of about 900 degrees Fahrenheit. Mercury does not have a thick blanket and the heat absorbed from the sun is drained during the night.