How does earth retains most of the atmosphere?

Due to force of gravity.