Fired heaters upstream of distillation towers, despite their optimal thermal efficiency, often suffer from performance decline due to fluctuations in fuel composition and unpredictable operational parameters. These heaters have high energy consumption, as fuel properties vary depending on the source of the crude oil. This study aims to optimize the combustion process of a three-gas mixture, mainly refinery gas, by incorporating more stable fuels such as natural gas and liquefied petroleum gas (LPG) to improve energy efficiency and reduce LPG consumption. Using real-time gas chromatography-mass spectrometry (GC-MS) data, we accurately calculate the mass fractions of individual compounds, allowing for more precise burner flow rate determinations. Thermochemical data are used to calculate equilibrium constants as a function of temperature, with the least squares method, while the Newton–Raphson method solves the resulting nonlinear equations. Four key variables (X4,X6,X8, and X11), representing H2,CO,O2, and N2, respectively, are defined, and a Jacobian matrix is constructed to ensure convergence within a tolerance of 1 ×10−6 over a maximum of 200 iterations, implemented via Python 3.10.4 and the scipy.optimize library. The optimization resulted in a reduction in LPG consumption by over 50%. By tailoring the fuel supply to the specific thermal needs of each processing unit, we achieved substantial energy savings. For instance, furnaces in the hydrocracking unit, which handle cleaner subproducts and benefit from hydrogen’s adiabatic reactions, require much less energy than those in the primary distillation unit, where high-impurity crude oil is processed.