The atmosphere is composed primarily of nitrogen and oxygen gases. It also contains smaller amounts of other gases like carbon dioxide, argon, and ozone. The atmosphere protects the Earth by absorbing harmful ultraviolet radiation from the sun and maintaining a stable temperature. It is divided into four main layers - the troposphere, stratosphere, mesosphere, and thermosphere - which differ in temperature and chemical composition.