This paper investigates the optimal placement of Distributed Power Flow Controllers (DPFC) to reduce power losses and enhance voltage profiles in electrical systems. It employs the Firefly optimization method and compares its results with the Genetic Algorithm, utilizing the voltage stability index (L-index) for the optimal positioning of DPFCs in power systems tested on IEEE 14 and 30-bus configurations. The findings demonstrate significant reductions in real and reactive power losses post-installation of DPFCs under various loading conditions.