This paper uses enhanced turbulent flow in water-based optimization (TFWO), specifically ETFWO, to achieve optimal power flow (OPF) in electrical networks that use both solar photovoltaic (PV) units and wind turbines (WTs). ETFWO is an enhanced TFWO that alters the TFWO structure through the promotion of communication and collaboration. Individuals in the population now interact with each other more often, which makes it possible to search more accurately in the search area while ignoring local optimal solutions. Probabilistic models and real-time data on wind speed and solar irradiance are used to predict the power output of WT and PV producers. The OPF and solution methods are evaluated using the IEEE 30-bus network. By comparing ETFWO to analogical other optimization techniques applied to the same groups of constraints, control variables, and system data, we can gauge the algorithm’s robustness and efficiency in solving OPF. It is shown in this paper that the proposed ETFWO algorithm can provide suitable solutions to OPF problems in electrical networks with integrated PV units and WTs in terms of energy generation costs, improved voltage profiles, emissions, and losses, compared to the traditional TFWO and other proposed algorithms in recent studies.