Integration of distributed generation units (DGs) and capacitor banks (CBs) in distribution systems aim to enhance the system performance. This paper proposes water cycle algorithm (WCA) for optimal placement and sizing of DGs and CBs. The proposed method aims to achieve technical, economic, and environmental benefits. Different objective functions: minimizing power losses, voltage deviation, total electrical energy cost, total emissions produced by generation sources and improving the voltage stability index are considered. WCA emulates the water flow cycle from streams to rivers and from rivers to sea. Five different operational cases are considered to assess the performance of the proposed methodology. Simulations are carried out on three distribution systems, namely IEEE 33-bus, 69-bus test systems, and East Delta network, as a real part of Egyptian system. The simulated results demonstrate the effectiveness of the proposed method compared with other optimization algorithms. Also, the results demonstrate that the proposed WCA gives superior performance for the system and give distinguished improvements in both economic and environmental benefits. Moreover, the results give the flexible operation with controllable power factor DGs that is better than those using DGs at fixed power factor.