In recent years, photovoltaic systems (PVs) have been increasingly integrated into radial distribution networks (RDNs). However, network operators experience significant issues because they are sporadic. To reduce the load on the main grid and improve the network performance, capacitor banks (CBs) are frequently employed for power factor correction and VAr compensation. However, a large number of CBs must be switched at once in accordance with variations in load and PV generation to maintain feeder voltage regulation and improve its performance. This study's optimization strategy for CB control considers a variety of goals. Using seasonal load profiles and PV generation patterns, a novel and efficient northern goshawk optimization (NGO) was created to determine the appropriate control of CBs. By resolving the typical CBs allocation problem in EDNs and comparing the findings with those in the literature, the effectiveness of NGO was initially cross-verified. In the second stage, an NGO is used to maximize annual net savings while maintaining the best possible control over CBs. Considering the PVs and CBs of the network, a modified IEEE 33-bus test system was used to evaluate the effectiveness of the suggested methodology.