system
Given the following post, respond as if you're commenting on Reddit:
human
How come the inner four planets of the Solar System are rocky and the outer four are gaseous?
gpt
A general reason is that it is more difficult to hold onto gasses the closer you are to a star, because planet temperatures get so high. The surface temperature of, for instance, Mercury is such that the random motions of gas particles (proportional to the local temperature) cause them to fly away from the surface. When planets are forming, it is believed that rocky cores build up until they get massive enough that they can capture lots of gas. For there to be cool enough gas to fall onto your planet, you need to be far away from the star.

This is, incidently, the same reason that gasses like nitrogen and oxygen are much more common in our atmosphere than, say, hydrogn (despite hydrogen being much more abundant in our solar system). Smaller particles move faster in the same temperature conditions, so the light elements were able to escape the Earth's atmosphere, and the heavier elements were retained.

Since exo-planets have started being discovered, astronomers have found many gas giants that are very close to their host stars (inside the orbit of Mercury, in fact), but these probably migrated in from farther out after they were formed. It is still an open question how this happens.