The atmosphere is actually a fluid. Like water, the pressure at the bottom of a deep column of fluid is larger than the pressure near the top of the column.
Fluids move in response to differences in pressure (the pressure gradient force), always flowing from high toward low pressure. In fact, the wind is driven by pressure differences measured in the horizontal directions. Therefore, the air near the ground (at the bottom of the deep atmosphere) is compelled to move upward toward lower pressure above.
The second fact is that the solid Earth is much more massive than the atmosphere above it which gives rise to the Earth’s gravitational force. Luckily, the force of gravity works in exactly the opposite direction, compelling the air toward the center of the Earth.
To near precision under most conditions, these two forces — the upward-directed pressure gradient force and the downward-directed gravitational force — are balanced, leaving the atmosphere in place surrounding the solid Earth. This important balance is known as the hydrostatic balance.
So, next time you are grateful you are surrounded by an ocean of air, thank the hydrostatic balance.