How do comets survive, when so much of their mass is outgassed when they come close to the sun?
They don't. Comets which orbit the inner solar system are very short-lived, lasting no more than a few tens of thousands of years on average. We still see comets this late in the solar system's lifetime because new comets occasionally fall in toward the sun from the Oort cloud, a spherical cloud of comets about 50,000 times as far from the sun as the earth (about 2000 times as far away as Pluto).
2012 update, with information from Cornell Professor Joe Veverka:
Comets that visit the inner Solar System typically have a diameter of 2 to 10 kilometers (about 1 to 6 miles). Comets are mostly ice, and as a comet gets closer to the Sun, the Sun heats and melts its part of its surface. Comets are porous, and the heat doesn't actually penetrate very far below the surface.
Comets, unlike the Earth, have very eccentric (elongated, not circular) orbits. Perihelion is the point in a planet's (or comet's) orbit at which it is closest to the Sun. As a general rule, a comet whose perihelion is 1.0 AU (the average distance from the Earth to the Sun) will lose about one meter of its surface in each perihelion passage. Comets that get closer than 1.0 AU may lose several meters of their surface. Therefore a typical comet can survive about a thousand orbits, and larger comets can generally survive for longer.
This page was last updated by Sean Marshall on September 7, 2015.