Atmosphere
The atmosphere is the envelope of gases surrounding the planet. It clings to Earth because, having mass, it is gravitationally attracted to the mass of the rest of the planet. Gas molecules move quite rapidly at earthly temperatures, and a few of them actually escape into space. Fortunately, Earth’s atmosphere is massive enough so that this leakage has not caused a significant loss of its gases over the billions of years.
From: https://kids.britannica.com/students/article/Earth/274103/273808-toc