Over the last decade, significant advancements have occurred in global electricity networks due to the widespread adoption of renewable energy resources (RES). While these sources offer numerous benefits such as cost-effective operation of solar photovoltaic and wind power stations and reduction of environmental hazards related to traditional power sources, they have also introduced various challenges to power network scheduling and operation. The traditional optimal power flow (OPF) problem, which is inherently complex, has become even more intricate with the integration of RES alongside traditional thermal power generators. This complexity arises from the unpredictable and intermittent nature of those resources. To tackle the intricacies of incorporating RES into conventional electric power systems, this study utilizes a pair of probability distribution functions to predict the power generation of wind and solar PV systems, respectively. The comprehensive OPF, which includes RES components, is expressed as a singular objective problem encompassing multiple goals including reducing fuel costs, emissions, real transmission losses, and voltage deviations. To tackle this challenge, a novel hybrid metaheuristic optimization algorithm (ACGO) is introduced. The ACGO algorithm combines Chaos game optimization (CGO) with the artificial ecosystem-based optimization (AEO) method to obtain the optimum solution for the OPF problem considering stochastic RES. This technique aims to enhance solution precision by increasing solution diversity through an optimization process. The modified optimizer's validation begins by examining its performance using well-known benchmark optimization functions, demonstrating its superiority over CGO, AEO, and other competitive algorithms. Subsequently, the modified optimizer is applied to a combined model of a wind and PV-incorporated IEEE 30-bus system. The ACGO technique proves to be highly effective, yielding the lowest fitness values of 781.