Though sun consists of helium and hydrogen gases only, its density is much higher than any material on the earth. why is it so?
Answers (1)
The density of a body in space (in this case the Sun) is governed by how much gravity it is experiencing. As a rule, the larger an object the stronger the gravity. In comparison with Earth or a smaller sun, there isn't as much gravity affecting it so it is less dense. All of the particles and atoms contained inside the sun are whizzing around very quickly, they have virtually no where else to go but into each other. The collision is so violent that the atoms fuse thus releasing enormous amounts of energy.
This energy is trying to escape and pushing outwards making the sun expand or swell, however Gravity is holding it back and at the moment there is equilibrium, meaning that the sun is (virtually) not changing in size. Once all of the energy has been spent, gravity will eventually win (this is inevitable for all stars) and the sun will collapse where it will become incredibly dense, eventually exploding in a supernova.
Luckily for us our sun won't collapse for about another 5 billion years so don't worry!
I hope this answers your question.