Heat source and transfer:
| UA*Deep Earth -> Shallow Earth -> Earth's Surface | -> Sun |
Earth's Surface | <- Sun |
The sun reflects the light and heat from a large object (the entire face of the earth) to a smaller focus the daytime spotlight. That is why sunlight is warmer than the surface of earth, it is focused onto a smaller area.
The earths surface is very warm, even at night. The amount of heat from sunlight is only about 20-40 degrees (daytime temps - nighttime temps), the heat that comes from the deep earth is about 500 degrees. This isn't very good evidence that the sun is the heater of earth and it's deeps...
The sun should also not be the second hottest as you suggest, since the sun reflects this energy back. The moon absorbs much of this energy, so it is likely to be warmer than the sun.