The thermocouple is a thin metal probe whose tip sits in the pilot flame, connected to the gas valve by a small tube. When the tip is hot, it produces a tiny electrical signal that holds the gas valve open for the pilot. If the flame goes out, the signal drops and the valve shuts off the gas, so unburned gas does not build up in the furnace.

That is why the classic symptom is a pilot that lights and stays lit while you hold the knob down, then goes out when you let go. The flame may look fine, but the gas valve is not getting a strong enough signal to stay open. A worn thermocouple, one that has been knocked out of the flame, a dirty tip, or a weak pilot flame that does not heat it fully can all cause this. Less often, the gas valve itself is at fault.