Check to make sure the pilot flame is touching the thermocouple tube. If it isn't adjust the position of the thermocouple tube. If that doesn't work, the thermocouple could be bad and needs replaced. That is what keeps the pilot lite, if it doesn't sense the flame, it shuts the gas off. Holding the button overrides the thermocouple until it is hot enough to keep the gas on. Get into your manual and check the troubleshooting section also.