In power systems, the power flow must satisfy a set of operational and safety requirements. It is a highly nonlinear problem to optimize the power flow. In this paper, the flower pollination algorithm (FPA) is modified and applied to optimize the power flow. Firstly, the author set up a mathematical model for power flow optimization problem, and formulated all the constraints. Next, the FPA was introduced in details, including the self-pollination, cross-pollination and other operations. After that, the local search strategy of the FPA was modified to replace the worst individuals in the current population with the best individuals in the previous population. Finally, the modified FPA (MFPA) was proved more efficient and better in convergence than standard algorithms like the firefly algorithm.