When a pilot light on a furnace continues to go out it can be caused by either the gas solenoid valve or even the the Thermocouple.
Most times when the pilot light won't stay on it's usually just the thermocouple going bad.
The thermocouple on a furnace is there to detect the heat from the pilot and if it doesn't work properly it will shut down the gas supply for safety.
Change out the thermocouple and that should solve the problems with the pilot light going out.
If that doesn't fix the problem then the gas solenoid valve may be bad.
If the gas furnace is 10 years old or older then it may be better to just replace the whole furnace with a new one so you won't have any further problems for many years.