Earth's atmosphere stays put for the same reason your feet remain firmly planted on the ground - Einstein's General Theory of Relativity.
Most of it escaped Mars' gravitational field precisely coz its mass is below the critical level necessary for its permanent retention. The gas giants, OTOH, retain bone-crushing atmospheres coz of their correspondingly larger masses.
If it were not so, stars would not form. Yet another fine-tuned universal constant courtesy of an unimaginably intelligent Creator whom you regularly dishonour with your anti-Christian tirades.