The earths atmosphere is not heated by the sun. The suns light comes in through the atmosphere. 25% of it is lost through reflection and then 50% is used to heat the surface of the earth, which then makes our planet warmer, and heats up the atmosphere. This heat is then stored around the earth because of the ozone layer, keeping us warm :)
1 4 1

the earth is heated up by the rays of the sun