The present invention relates to the preparation of foaming formulations for high temperature, salinity and concentration of divalent ions, such as Calcium and Magnesium, that apply the synergistic effect of sodium alpha olefin sulfonates and alkyl amido propyl betaines; said inventions may use, as solvent, water, sea water, connate water, alcohols or mixtures all thereof. Said formulations control the piping of gas in reservoirs of the naturally fractured carbonate type.