Power loss minimization and improved voltage profile have been major challenges faced by the electrical distribution network (DN) mainly because of the long length of the feeders and the high resistance to reactance (R/X) ratio of the DN. A lot of techniques have been investigated to solve these problems. One of the most prominent is the optimal integration of distributed generation (DG) such as photovoltaic (PV) as well as the integration of Distribution Static Synchronous Compensator (DSTATCOM) into the network. The main challenge with this solution has been the determination of the optimal sizes and sites of the DG and/or DSTATCOM. This paper seeks to optimize the simultaneous allocation of multiple DSTATCOMs and PVs in the DN for power loss reduction and voltage profile improvement using the rat swarm optimization (RSO) technique, which is a simple, yet robust optimization technique. The optimization problem is formulated to minimize power loss, voltage deviation index, and maximize the voltage stability index. The IEEE 33 node DN is used as a test network and the simulation results show the effectiveness of the RSO technique in finding the best sizes and locations of the PVs and the DSTATCOMs. The power losses of the network are reduced from 210.996 kW, and 143.129 kVAr when there is no DSTATCOM nor PVs in the network to 26.155 kW, and 19.128 kVAr when DSTATCOM and PVs are simultaneously allocated into the network. A remarkable improvement in the voltage profile of the network is also observed with the minimum node voltage being 0.98 p.u. compared to 0.9038 p.u. when there are no DSTATCOMs or PVs. The RSO results were compared with other techniques from the literature, and it proved its superiority.