Answer: The earth is comprised of silicate materials as well as metals. The amount of gas is less here because of its location near to the sun. Due to its relative high surface temperature, the gases such as hydrogen and helium gets evaporated and disappears.
Whereas the sun is entirely comprised of hydrogen and helium gas, of which hydrogen is the dominant one. It has an extremely high temperature of about 5500°C.