Can gravity not act on air? What causes hot air to rise and cold air to fall? What causes buoyancy?
Conceding for a moment that gravity as such exists, yes it could act on air, but the force of gravity does not suffice to overcome the tendency of entropy. This is easily demonstrated, and has been demonstrated, simply by putting a vacuum chamber on top of a container filled with gas. Demonstrations show that not only does the air spread upward into the vacuum, but water in the bottom of the container also evaporates. Gravity, if it exists, is an extremely weak force.
As for buoyancy, I think your question is what accounts for the directionality of the buoyancy, and there are two thoughts out there, 1) some electromagnetic forces inherent in matter, or 2) the flow of ether. I don't buy the Einsteinian stuff about curvature of space-time.
So the common explanation (except for raw gravity) is that there not enough air pressure at the top edges of the atmosphere to push the molecules/atoms out into the vacuum, since that's actually what's happening (vacuums don't actually "suck" from a physics standpoint), but this is just kicking the can down the road, because it doesn't explain why the entropy does not cause the more dense (higher pressure) molecules to push into the less dense areas, and the only plausible explanation for this is that this is all taking place within a container with a finite volume.