Body temperature is controlled through the process of thermoregulation, which allows the body to maintain a consistent temperature at its core. Homeostasis is the state which occurs when thermoregulation is successful.
The only safe body temperatures are between 98 and 100 degrees Fahrenheit. Thermoregulation itself is a three-step process that begins with the central nervous system in an attempt to keep the body temperature within this range. When the central nervous system sends messages to the hypothalamus that the body's internal temperature is changing, one of several mechanisms is activated in an attempt to restore homeostasis. The body may first produce excess sweat in an attempt to cool off the skin and lower its temperature. The body may also dilate the capillaries near the skin to allow the blood to release heat through the surface.
There are heat and cold receptors in the skin that allow the central nervous system to respond to heat or cold in the first place, triggering these crucial temperature adjustments. The body can also produce heat when its temperature gets too low. To do so, the body may also activate the thyroid gland in extremely cold temperatures, increasing metabolism which, in turn, produces more heat.