The Gravitational force between two point masses separated by a distance $r$ is proportional to $\dfrac{1}{r^2}$, just like the electric force between two point charges. Because of this similarity between gravitatonal and electrical interactions, there is also a Gauss's law for gravitation. Let $g$ be the acceleration due to gravity caused by point mass $m$ at the origin so that $g = \dfrac{-Gm}{r^2} \hat{r}$. Consider a spherical Gaussian surface with radius $r$ centered on this point mass.