An atmosphere is a layer of gases that envelop an astronomical object, held in place by the gravity of the object. The name originates from Ancient Greek ἀτμός (atmós) 'vapour, steam' and σφαῖρα (sphaîra) 'sphere'. An object acquires most of its atmosphere during its primordial epoch, either by accretion of matter or by outgassing of volatiles. The chemical interaction of the atmosphere with the solid surface can change its fundamental composition, as can photochemical interaction with the Sun. A planet retains an atmosphere for longer durations when the gravity is high and the temperature is low. The solar wind works to strip away a planet's outer atmosphere, although this process is slowed by a magnetosphere. The further a body is from the Sun, the lower the rate of atmospheric stripping.
Read more on Wikipedia