Is there any form of matter in space?

As per I know that vacuum have capability to attract gas to fill itself. It has been proved through experiments. In space there is a huge vacuum and a vacuum of this quantity can create huge pull, but if we apply this fact on space then space do not attract gas towards itself. If it does then there will be no gas on stars and planets. Is there any possibility that space is filled with some sort of matter which stops gas to attract towards space.

• There is no pull: gas tends to expand and, in doing so, to occupy available (empty) space. What we might feel as suction is a difference between pressures. – stafusa Oct 5 '17 at 19:57

You have quite a great misunderstanding.

It is true that a gas fills up a vaccum space if it is exposed to it. But there is no vaccum pull or anything like that acting. There is no such phenomena.

A gas fills up the space because of difference in pressure and its property of diffusion. Due to the availability of a huge space, the gas expands, and the molecules go further apart from each other, thereby diffusing into the space. The gas tries to bring the concentration same at all parts of the container, so that gas diffuses and equalises the concentration in answer to a pressure gradient.

Now, why do gases from Earth do not escape into space, even though the gases have a chance to diffuse? This is simply because of Earth's gravitational pull. The force of gravity prevents the gases from escaping out to space. This also explains that planets, which have lesser gravity than that of the Earth, don't have an atmosphere, because all of their gases have escaped into space.

The density of the atmosphere decreases as one goes further away from the surface of the Earth. This is because the the force of gravity decreases as one goes further away from the surface. If $g$ is the acceleration due to gravity at a certain height $h$ from the surface of the Earth, and $g_0$ is the acceleration due to gravity on the surface,and $R_e$ is the radius of the Earth, then $$g = \dfrac {g_0}{ \left( 1+\frac {h}{R_e} \right)^2 }$$

Expanding binomially and neglecting less significant terms when $h << R_e$, $$g = g_0 \left( 1 - \frac {2h}{R_e} \right)$$

The equation shows that the value of acceleration due to gravity decreases with increase in altitude.

So, the gases tend to accumulate more near the surface due to the greater gravitational pull near the surface, and the density of atmosphere decreases with increase in altitude.

In space there is a huge vacuum

No, space is a huge partial vacuum. Some are more partial than others.

As per I know that vacuum have capability to attract gas to fill itself

Vacuum does not pull on gas. Gas pushes on other gas. So when you start with a ball of gas, like in the big bang, it will want to expand.

Once the density gets low enough, this force becomes very small. Smaller than gravity, which is why there are planets and such.