I was really just making some random comments about intermolecular interactions in a general sense (addressing the question about a common force) not really addressing your question about the effect of gravity on the atmosphere. Wrt to gases, sometimes we need to take intermolecular interactions into account (explaining why something is in the gas phase) and sometimes we ignore them (PV=nRT equations).
Steve did a good job of covering the roll of gravity.
I will add that when I am looking at a problem and trying to figure if something is going to happen or not and there are different forces at work (some of them competing) … I will look at it in terms of energy balances.
If the force of gravity is holding the atmosphere to the Earth but the pull of gravity decreases as distance increases (or in this case very high altitudes) it seems perfectly reasonable to wonder why gas particles in the upper atmosphere don’t ultimately diffuse (not sure if that is the correct term but you get the point) into space.
I did some calculations and the thing is … the gravitational force between the Earth and an oxygen molecule at sea level is 5.22x10^-25 N and the force between the Earth and an oxygen molecule at 100,000 meters above the Earth is 5.06x10^-25 N. So, even at extremely high altitudes the force of gravity is still about 97% of what it is at sea level (assuming I did my calculations correctly ... I can post them if you would like).
But let’s assume for the sake of argument a very slight decrease in the gravitational force may allow some molecules to escape.
At higher altitudes, the temperature is lower than it is at the surface suggesting the average kinetic energy of the gas particles (or in other words, the motion of the gas particles) is lower than that of the gas particles near the surface (I am guessing this to be true). The kinetic energy is a competing force; I would suspect that if the kinetic energy of the gas particles is great enough, the particles will escape the Earth’s gravitational field.
So, I don’t know enough about it to tell you quantitatively where you need to be in terms of (1) the gravitational force between the Earth and the gas particles in the atmosphere and (2) the kinetic energy of the gas particles in the atmosphere … but, it seems to me that if we assume the gas particles possess less kinetic energy at high altitudes than they do at sea level, and that the gravitation force doesn’t really change that much between sea level and very high altitudes then we can venture a guess that gravity can hold onto the upper atmosphere.