This paper introduces a Modified Reptile Search Algorithm (MRSA) designed to optimize the operation of distribution networks (DNs) considering the growing integration of renewable energy sources (RESs). The integration of RESs‐based Distributed Generation (DG) systems, such as wind turbines (WTs) and photovoltaics (PVs), presents a complex challenge due to its significant impact on DN operations and planning, particularly considering uncertainties related to solar irradiance, temperature, wind speed, consumption, and energy prices. The primary objective is cost reduction, encompassing electricity acquisition, PV and WTs unit costs, and annual energy losses. The proposed MRSA incorporates two strategies: the fitness‐distance balance method and Levy flight motion, enhancing its searching capabilities beyond standard Reptile Search Algorithm and mitigating local optima issues. The uncertainties in load demand, energy prices, and renewable energy generation are represented through probability density functions and simulated using Monte Carlo methods. Evaluation involves typical bentchmark functions and a real 112‐bus Algerian DN, comparing MRSA's efficacy with other optimization techniques. Results indicate that the proposed DN optimization program with WTs and PVs integration reduces annual costs by 21.43%, from 6.2715E + 06 to 4.9270E + 06 USD, reduce voltage deviations by 21.67%, from 77.1022 to 60.4007 USD, and enhance system stability by 2.59%, from 2.3699E + 03 to 2.4314E + 03 USD, compared with the base case.