The Moon can escape only if there is no orbital motion. In fact, the Moon while revolving around the Earth, has also orbital velocity around the sun. The gravitational force of attraction of the sun to the Moon provides the required centripetel force necessary for the orbital motion around the sun.