This question strikes at one of the most active areas of current astronomical research. Not surprisingly, several scientists wrote in to give their answers.
David Van Blerkom, a professor of astronomy at the University of Massachusetts at Amherst, provides a nice overview, focusing on the second part of the query:
"The fact that the outermost region of the sun's atmosphere is at millions of degrees while the temperature of the underlying photosphere is only 6,000 kelvins (degrees C. above absolute zero) is quite nonintuitive. One would have expected a gradual cooling as one moves away from the central heat source. A related question is why, if the corona is so hot, it does not heat up the photosphere until it has an equally high temperature.
"I will address these questions in reverse order. Let us first ask what it means for a gas to have a high temperature. The answer is that temperature is a measure of the average kinetic energy of the gas atoms, that is, a measure of how fast they are moving. A high temperature gas has atoms with a larger average velocity than a low temperature gas of the same composition. We thus infer that the atoms in the corona are moving much more rapidly than those in the photosphere.
"In order for the corona to make the photospheric temperature rise, the coronal gas must cause the photospheric atoms to move faster. It could do so by colliding and mixing with the cooler gas and thus transfering some of its kinetic energy. Another way is also possible: At a temperature of millions of degrees, the gas in the corona is highly ionized, that is, electrons are stripped off neutral atoms and move freely. Because electrons are thousands of times less massive than atoms, the hot electrons have very high speeds. These electrons could travel into the photospheric gas and collide with the atoms there, again increasing their velocities. These two heating mechanisms are called convection and conduction, respectively.