According to HowStuffWorks, the thermocouple in a gas furnace uses two dissimilar metals that produce an electric current when heated in order to power an electromagnet that opens a valve allowing gas to reach the furnace. If the pilot light goes out, the thermocouple cools and no longer produces the current, so the electromagnet releases the valve to stop the gas flow.
According to About.com, manufacturers surround the thermocouple junction with a protective metal casing. They install this unit so the gas flame from the pilot light hits the casing directly to heat it. The design includes a threaded attachment that allows adjustment to ensure the thermocouple receives the right amount of heat to keep the valve in its activated position.
In older and less efficient furnaces, once the owner lights the pilot light, it continues to burn around the clock unless shut off by the thermocouple. In higher efficiency units, an electronic igniter lights the pilot light, which then lights the furnace burner. When debris collects in the tip of the pilot light, gas flow may be restricted to the point that the unit no longer remains lit. San Francisco Gate recommends cleaning the opening with a toothbrush every few months. Some units have a screw that allows adjustment of the size of the pilot light flame.