Lava tops out around 2,200°F—nowhere near as hot as the Sun. But 4,000 miles beneath our feet, the Earth's solid iron core is hotter than the Sun's surface.
When a volcano erupts, the magma (which becomes lava once it reaches the surface) typically originates in the Earth's upper mantle or lower crust, just a few dozen miles down. While it is hot enough to melt steel, it is relatively cool compared to the deeper interior of our planet.
To find temperatures that rival a star, you have to travel straight down to the inner core. This solid ball of iron and nickel sits under crushing pressure, trapping primordial heat from the planet's formation 4.5 billion years ago, supplemented by the slow decay of radioactive isotopes. At this depth, the temperature reaches an estimated 10,800°F (6,000°C).
If you look up at the Sun, the part you see is the photosphere—its glowing outer surface. The temperature of the photosphere is roughly 10,000°F (5,500°C). So, the solid metal at the very center of our planet is actually slightly hotter than the fiery surface of the star we orbit.
But this comparison only works if you stick to the Sun's surface. If you compare the centers of both bodies, the Earth falls far behind. At the core of the Sun, nuclear fusion is constantly crushing hydrogen atoms together into helium. The temperature there reaches an astonishing 27 million °F (15 million °C).