The oil and gas industry uses very expensive electrical submersible pumps (ESPs) to lift oil to the surface. It is common for the ESP to operate with a biphasic gas-liquid flow. However, large amounts of gas inside the pump generate instabilities, such as surges and gas locks. If operated for a long time under such instabilities, the performance of the ESP can decrease significantly, causing premature deterioration, which can lead to heavy losses and even a complete stoppage of production. To reduce the occurrence of this unstable operation, the research presented here proposes an adaptive controller based on the monitoring of the biphase condition. A nonlinear ESP model represents the pump behavior for a variable percentage of the two-phase flow, used by the controller learning complex adaptive technique, which is based on a genetic algorithm to generate a set of rules to keep the ESP in safe operating conditions. At the beginning of the training, the adaptive complex system generated erratic behavior; however, over time, it came to represent more precise rules, bringing performance to stable conditions. Furthermore, if the ESP eventually reaches a harmful condition, the adaptive controller takes action to return it to a safe condition. The result of the simulated tests shows that the complex adaptive controller can acquire enough knowledge after training to keep an ESP working in stable conditions, increasing the life of the production equipment and avoiding sudden stops during oil lifting.