The thermostat regulates the flow of coolant through the engine to maintain the optimal operating temperature. If the thermostat is faulty, it can lead to temperature fluctuations.