In flying ad hoc networks (FANETs), load balancing is a vital issue. Numerous conventional routing protocols that have been created are ineffective at load balancing. The different scope of its applications has given it wide applicability, as well as the necessity for location assessment accuracy. Subsequently, implementing traffic congestion control based on the current connection status is difficult. To successfully tackle the above problem, we frame the traffic congestion control algorithm as a network utility optimization problem that takes different parameters of the network into account. For the location calculation of unknown nodes, the suggested approach distributes the computational load among flying nodes. Furthermore, the technique has been optimized in a FANET utilizing the firefly algorithm along with the traffic congestion control algorithm. The unknown nodes are located using the optimized backbone. Because the computational load is divided efficiently among the flying nodes, the simulation results show that our technique considerably enhances the network longevity and balanced traffic.