The paper is proposed an improved equilibrium optimizer (IEO) algorithm to solve the optimal power flow (OPF) problem with the participation of a renewable energy source (RES). In the proposed IEO method, the “exponential term” is replaced by a function that does not dependent on the number of iterations. This modification of the IEO algorithm increases exploration ability compared to EO algorithm. In addition, the exploration of the proposed IEO algorithm will not decrease according to the number of iterations which avoids to get stuck at the local optimal solution. The IEO algorithm is tested on two IEEE 30-bus and IEEE 118-bus systems with three different objective functions. The performance of the proposed IEO method is compared with equilibrium optimizer (EO), artificial ecosystem optimization (AEO), cuckoo search algorithm (CSA), teaching-learning-based optimization (TLBO), artificial bee colony (ABC), and many other existing methods. Besides, a simple probabilistic formula for calculating RES output power based on the Monte-Carlo simulation model is proposed in this paper to reduce the computation time for the OPF problem with RES. The simulation results obtained show that the proposed IEO algorithm has better quality of the solution as well as stability level compared to the original EO algorithm and other algorithm. Thus, the proposed IEO algorithm is also one of effective and reliable algorithms for handling OPF problem with RES.