Water heaters that run on gas use a pilot light. The pilot light provides a constant flame source that ignites gas coming into the unit. The gas then heats the water. If the pilot light will not stay lit, it may need to be adjusted so that the pilot flame is higher. If the pilot flame is too low, gas or wind may cause it to blow out. If adjusting the pilot flame does not solve your issue, you may need a new thermocouple or pilot light assembly.
Turn off the gas supply to the water heater by turning the gas valve to the "Off" position.
Remove the front access panel of the water heater by pushing in the tabs to release the panel, or removing the screws that hold it in place.
Poke the inside of the pilot light with a needle to remove any soot inside. Wipe away the soot with a toothbrush.
Adjust the pilot light by turning it inside its bracket so it is straight up in the air. Tighten the bolt that holds the pilot to the water heater to keep it in place.
Turn the gas back on.
Press in the ignitor button and hold a match to the pilot assembly. Adjust the gas supply up or down until the pilot is a blue flame, not yellow. Replace the access panel.