This paper proposes an improved equilibrium optimizer (IEO) for determining optimal location and effective size of distributed generation units (DGUs) in the distribution systems in order to minimize the total power loss on distribution branches, investment cost, and operation and maintenance cost. In a good obtained solution, limits of voltage, current, and harmonic flows are also seriously considered, exactly satisfying predetermined ranges. Especially, individual harmonic distortion (IHD) and total harmonic distortion (THD) of bus voltage must fall into IEEE Std. 519. The proposed IEO is developed from the original equilibrium optimizer (EO), which was motivated by control volume mass balance models. This novel algorithm can effectively expand the search area and avoid the premature convergence to low-quality solution spaces. With the determined solutions from IEO, not only are the voltages well improved but also the harmonics are mitigated from the violated values down to the allowable values of IEEE Std. 519. Moreover, the total power loss is significantly reduced from 0.2110 MW to 0.0815 MW, 0.2245 MW to 0.07197 MW, and 0.3161 MW to 0.1515 MW for IEEE 33-bus, IEEE 69-bus, and IEEE 85-bus radial distribution systems, respectively. Not only that, the total cost of DGUs is also more economical and consumes only $3.4753 million, $3.2840 million, and $3.0593 million corresponding to the three systems for a 20-year planning period. The performance of the proposed algorithm is compared to three other implemented methods consisting of artificial bee colony (ABC) algorithm, salp swarm algorithm (SSA), and EO and eight previously published methods for the three test systems. The comparisons of results imply that IEO is better than other methods in terms of performance, stability, and convergence characteristics.