This research analyzes electrical distribution networks using renewable generation sources based on photovoltaic (PV) sources and distribution static compensators (D-STATCOMs) in order to minimize the expected annual grid operating costs for a planning period of 20 years. The separate and simultaneous placement of PVs and D-STATCOMs is evaluated through a mixed-integer nonlinear programming model (MINLP), whose binary part pertains to selecting the nodes where these devices must be located, and whose continuous part is associated with the power flow equations and device constraints. This optimization model is solved using the vortex search algorithm for the sake of comparison. Numerical results in the IEEE 33- and 69-bus grids demonstrate that combining PV sources and D-STATCOM devices entails the maximum reduction in the expected annual grid operating costs when compared to the solutions reached separately by each device, with expected reductions of about 35.50% and 35.53% in the final objective function value with respect to the benchmark case. All computational validations were carried out in the MATLAB programming environment (version 2021b) with our own scripts.