The atmosphere is composed of various layers defined by temperature: the troposphere, stratosphere, mesosphere, thermosphere, and exosphere. It contains a mixture of gases such as nitrogen, oxygen, carbon dioxide, and water vapor. The atmosphere plays an important role in regulating Earth's climate by trapping heat and blocking harmful solar rays, making the planet habitable for life.