It's not a binary situation where a planet has enough gravity for an atmosphere or can't hold onto any atmosphere. The major factors are escape velocity at the uppermost levels of the atmosphere compared to the velocity distribution of the molecules at those altitudes, and the rate of replacement. A molecule moving faster than escape velocity in the uppermost reaches of the atmosphere has a good chance of escaping the planet. If the rate of loss is greater than the rate of replacement, the atmosphere will thin until the two are equal.
The replacement rate also varies over time. Mars was more volcanically active in the past. Also, the rate of bombardment by asteroids and comets was higher in the past. Both of these mean that the replacement rate of atmosphere used to be higher.