Our planet receives a moderate amount of energy from space. Our atmosphere absorbs much of that energy, protecting the life here. Earth has an abundance of water. Water is a unique chemical. It has a small molecule but its unequal charge allows it to dissolve almost any material.
Liquid water holds a huge amount of heat energy and resists changes of state to solid or gas.
When it freezes it becomes less dense and floats on liquid water, it also releases most of its heat energy into the surrounding water leaving it warmer. When water evaporates it carries heat energy with it, this cools the remaining water. The seas resist freezing and boiling. Earth experiences a temperature range that allows most of the water to remain as liquid or solid. Unequal heating of our planet by our sun moves water vapor over the planet distributing energy.