We generally imagine that Earth’s atmosphere is a constant, but this isn’t so. It turns out air does escape our atmosphere, but it isn’t anything to worry about. For any planet, the larger its mass the easier it is to hold on to a gaseous atmosphere. This is part of the reason why Mars has such a thin atmosphere compared to Earth. It also depends on things like temperature (hotter gasses can escape more easily), density (lighter gasses escape faster than heavier gasses), and if the planet has a strong magnetic field (magnetic fields help hold gasses).
Of course that raises an interesting mystery. Venus is a little smaller than Earth, hotter than Earth, and doesn’t have a strong magnetic field like Earth, so it should have a less dense atmosphere than Earth. In fact, the atmosphere of Venus is much thicker than Earth’s. Why?
It turns out that Earth has something Venus doesn’t – liquid water. Water is very good at absorbing gasses like carbon dioxide. Water also helps put gasses like CO2 into rocks. So, Earth’s atmosphere would be thicker than Venus except for the fact that so much gas is trapped in water and rocks. So the wetness of our planet not only helps to regulate our temperature, it ensures that we don’t get crushed by a thick atmosphere.
So how much time do we have? Given the rate at which we lose atmosphere, and all the spare atmosphere we have trapped in the oceans and rocks, we will have atmosphere for as long as the sun shines. That gives us about 5 billion years, so mark your calendars!