The thermocouple is a safety feature in gas water heaters which determines if the pilot light is lit. The heat of the pilot light flame creates millivolt current in the thermocouple which energizes a magnet that in turn allows the gas control valve to operate. If the pilot light goes out, the thermocouple produces no power and the magnet closes the valve and will not allow the gas to flow.
A common symptom of a faulty thermocouple is the pilot light will not stay lit. Check that the thermocouple connection to the gas valve is tight and the other end of the thermocouple is properly positioned in or near the pilot light flame. If it appears properly installed then it may need to be replaced.
Turn off the gas supply to water heater.
Remove outer and inner doors.
Disconnect the burner assembly from the gas control by loosening the pilot tube, supply tube and thermocouple connections.
Remove burner assembly from the combustion chamber.
Remove the old thermocouple from the bracket. It may be held in place with tension or a screw. Loosen the screw, if any, and pull firmly and twist the thermocouple from the bracket.
Install the new thermocouple. Position the thermocouple tip so that the pilot flame heats the top 1/2 inch of the tip.
Replace burner assembly in combustion chamber.
Tighten the main burner supply tube, pilot supply tube and thermocouple connection to the gas control valve. Turn the thermocouple no more than one quarter turn beyond hand tight.
Turn on the gas supply
Check main supply tube and pilot supply tube at the gas control valve for gas leaks with a soap and water solution. Bubbles indicate a leak. Tighten all connections if a leak is found.
Light the pilot light.
Check that 1/2 inch of the thermocouple tip is positioned in the flame.
Replace inner and outer doors.
Replacing the thermocouple should restore power to operate the gas valve and keep the flame going. If the problem continues, the problem may be with the gas valve itself. If the gas valve fails, due to its high cost, it may make sense to replace the entire water heater, especially with older models.