Hi, this sounds just like a bad thermocouple. Your thermocouple is the device that detects if you have a pilot flame. Once the thermocouple detects the pilot flame it will allow the main gas valve to open and your main burner ignites. This device will be right above the pilot on the stove. The pilot should be burning on this device at all times.
First (take note of the position of the thermocouple) then you can try pulling the thermocouple and cleaning it with steel wool. Sometimes the thermocouple will get build up on it and become less sensitive. If this happens, even if the pilot is strong and burning on the thermocouple it still will not read the flame and shut down the unit.
So, clean the thermocouple and re-position it so that it is in the flame at all times. If this doesn't help your unit I would replace the thermocouple before I did anything else. Your local gas company will have a thermocouple for you. They are not that expensive, so replace the thermocouple first before you replace the control box.