If the pilot light on your water heater keeps going out it is probably a bad thermocouple. A thermocouple sends a signal to the main gas control on the water heater Telling it the pilot is on. If the thermocouple goes bad It will send a false signal and the pilot will go out. The solution is simple replace the thermocouple. They come in several lengths and is important to get the correct size.
The new gas fired water heaters, they have a sealed chamber, need to get there air, to burn the gas properly from vents in the side of the tank or from the bottom of the tank.
If these vents are not clear, the flame and pilot will starve for air and go out. The vents need to be cleaned using a shop vac.