Gases in the atmosphere such as carbon dioxide dowhat the roof of a greenhouse does. During the day, the Sun shines through the atmosphere. Earth'ssurface warms up in the sunlight. At night, Earth'ssurface cools, releasing the heat back into the air.