I almost never see "sun" and "moon" capitalized. "Earth" usually is capitalized when referring to the planet, but it's not when it's used metaphorically ("He has a down-to-earth personality.")
seems to have been answered already but here's my input: we, in the english language, happen to have named our sun after the word for sun. so, when it is important to emphasise you are referring to *our sun*, capitalise it as The Sun. when it doesn't really matter, just say the sun.