This study appears to be the first to use a MATLAB simulator to illustrate Particle Swarm Optimization with multiple input–output restrictions. This proposed study's overarching objective was to make the entire process energy efficient, which provides improved performance with high accuracy and minimizes the operating cost by incorporating energy, ventilation, and CO2. Further, to reduce the complexity of the system, the optimization technique was divided into control and controlled variables. Meanwhile, to define state constraints for variables used in the objective function was to make the overall process cost‐effective, composing energy, CO2 supply, and ventilation cost. The chosen technique effectively decreased operating costs while maintaining the appropriate ranges for temperature (14–26°C), relative humidity (0–90%), and CO2 concentration (400–2000 ppm), according to simulation results. Off‐peak, standard, and peak energy cost levels were R1080.26, R748.56, and R7078.4, respectively. On the other hand, it was found through comparative analysis that the standard and off‐peak energy consumption figures decreased by 65.4 and 8.1%, respectively, as compared to the peak tariff (2279.9 kWh). The suggested PSO technique is implied to be a viable means of increasing greenhouse energy efficiency and achieving sustainable, cleaner manufacturing.