All celestial bodies lose atmosphere due to a portion of the gas "near space" exceeding escape velocity. The velocity distribution of an ideal gas can be found using the Maxwell-Boltzmann distribution. So an easy approximation for this problem is to say we only want $10^{-6}$ of the molecules to have escape velocity. Using oxygen at 300K, results in an escape velocity of around 2.2 km/s. If we wanted only $10^{-16}$ of our particles to escape, that bumps the escape velocity up to 3.5 km/s
$$KE+GPE=0$$
$$\frac12mV^2 + -\frac{GMm}{r}=0$$
$$V^2-\frac{2GM}r=0$$
Let's first assume the atmosphere is thin compared to the dimensions of the planet. This allows us to use the same radius for the gravitational potential energy and the planet radius, and it allows us to neglect the mass of the atmosphere.
$$M=\rho\frac43\pi r^3$$
$$V^2-G\rho\pi\frac83 r^2=0$$
$$r=\frac{V}{\sqrt{G \rho \pi \frac83}}$$
$$M=\frac18V^3G^{-3/2}\sqrt{\frac6{\pi\rho}}$$
For escape velocities of 2.2 and 3.5 km/s the masses of the planet would be $4.7\cdot10^{22}$ and $1.9\cdot10^{23}$ kg respectively. This latter number is just a bit larger than the mass of Titan, the only known natural satellite with a dense atmosphere.
Note that the density is the denominator of this final equation indicating that a purely gaseous planet would have to be more massive to keep its atmosphere.