A gas molecule has no measurable effect on a planet, but a planet pulls nearby gas molecules toward itself. This pull makes the larger atoms, such as nitrogen and oxygen, heavier than the tiny hydrogen atoms, and keeps most of them near the planet's surface. Even there, the closer that the atoms are to the surface, the more thickly they are crowded together. How closely they are crowded is referred to as atmospheric density . The more atoms you have in a given space, the more dense the atmosphere is.
Density refers to how tightly the atoms are packed together.
Density is affected by gravity, and also by how many atoms there are to pack together. Suppose that you were given a cubic yard of the earth's sea level atmosphere and asked to count the atoms in it. That cube of air would have many billions of atoms in it. Now, for comparison, let's think about a cubic yard of the moon's atmosphere. The atmosphere of the moon is difficult to detect and very diffuse when compared with the earth's atmosphere.