In most cases, your thermocouple is bad. The thermocouple consists of the two tubes that come out of the gas valve and go into the combustion chamber at the bottom of the water heater. They can be replaced. Sometimes water leaking in the tank can drip down and snuff the pilot light out. If the tank is leaking down onto the pilot light, usually you have to replace the water heater. Before you hire someone to replace a thermocouple, check the date when your heater was built. All water heaters come with a six year warranty. If it is newer than six years old, call the manufacturer to send a warranty representative out to look at it. All this information can be found on the stickers on your water heater or the warranty paperwork that came with the heater. Sometimes this paperwork can be found in a packet attached to the side of the heater.