I had the opposite problem, the pilot light would stay lit but I could not get the burner tray to light.
One thing to check before you go any further, check to see that the fitting where the thermocouple enters the gas valve has a tight connection.
Other than that, if you're holding the valve button down for an adequate amount of time (my pilot light took easily 90 seconds to ignite after I replaced the gas valve) to ensure the thermocouple becomes active, I can't figure out what else it might be. I managed a small apartment complex for a while and it was amazing how many people thought that as soon as the pilot light ignited they could release the control knob--it can take as long as 60 seconds, perhaps more for marginal older thermocouples, after the pilot light has ignited before the thermocouple heats up adequately to generate the signal that keeps the pilot light lit.
Good luck, let us know what it turns out to be, please!