One of the problems that sometimes occur in gas allocation optimization is instability phenomenon. This phenomenon reduces the oil production and damages downhole and surface facilities. Different works have studied the stability and suggested some solutions to override it, but most of them (such as making the well intelligent) are very expensive and thus they are not applicable to many cases. In this paper, as a new approach, the stability has been studied in gas allocation optimization problems. To prevent the instability, instability has been assumed as a constraint for the optimizer and then the optimizer has been run. For the optimization, first a genetic algorithm and then a hybrid of genetic algorithm and Newton-Quasi have been used, and their results are compared to ensure the good performance of the optimizer; afterwards, the effect of adding the instability constraint to the problem on production reduction have been discussed. The results show that the production loss with adding this constraint to the system is very small and this method does not need any additional and expensive facilities for preventing the instability. Therefore, the new method is applicable to different problems.