the flame in most gas oven is monitored by a thermo couple. if these fail or have bad connections the oven will cut off the gas for safety purposes. We suggest you get a gas safe engineer to look at the problem as we cant condone self repair of gas appliances