The gas fire will only keep the pilot flame alight if the thermocouple (which is heated by the flame) reaches the prerequisite temperature. Take a close look at the flame, there should be a thin metal rod heated by the flame.
The metal rod is quite flexible and can easily be moved such that it is heated by the flame – but don’t wiggle it too much or it will break.
Of course the thermocouple could have failed and need replacing.
thermo couples have a life span, on my old heating system i replaced it every 4-5 years...
Thermo couple £6.00 20 mins to fit...not sure what a heating engineer would charge to do the job though..