Multi-agent systems (MAS) have attracted significant attention in recent years due to their wide applications in cooperative control, formation control, synchronization of complex networks, and distributed coordination. A fundamental problem in MAS is the leader-follower consensus or cooperative tracking, where the followers are required to track the state trajectory of the leader agent. To solve the leader-follower consensus problem, we propose a novel evolutionary computation approach to design the optimal distributed control protocols for leader-follower MAS. First, we formulate the design of distributed control gains for leader-follower consensus as an optimization problem to minimize tracking errors. Then, we leverage particle swarm optimization as an efficient evolutionary technique for distributed gain optimization in multi-agent networks. Finally, we guarantee stability for the closed-loop dynamics under directed communication topologies based on algebraic graph theory. The simulation results indicate that the proposed method yields a diminished tracking error, expedites the convergence process, and minimizes the requisite control effort while enhancing computational efficiency. Furthermore, these results exemplify the method's versatility when applied to nonlinear dynamic scenarios, directed network topologies, fluctuating disturbances, and optimization across multiple domains.