When the topological structure of the microgrid system changes, the traditional droop control strategy sometimes causes the output power, frequency, and voltage of the inverter to exceed their limits and oscillate, and traditional strategies cannot guarantee the dynamic performance and steady-state accuracy of inverter control. To this end, this paper is based on an improved three-partition fruit fly algorithm. An optimization strategy for grid-connected inverter droop control is proposed in this paper, and then, the PI parameters of microgrid droop control are optimized in real time. This strategy divides the fruit fly population into three zones according to the inverter output and then automatically updates the multistrategy mode according to the difference in fruit fly performance in each zone. Among them, in zone I, a local fine search is conducted to ensure that the population does not degenerate; in zone II, adaptive adjustment is performed, ensuring the diversity and convergence of the algorithm; and in zone III, fruit flies are guided to accelerate convergence. The effectiveness and feasibility of this strategy is verified by this article according to simulation experiments and actual application cases. The results show that the proposed control strategy can make the inverter output follow the changes in the system for adaptive adjustment. The inverter response speed is increased 40-fold, and the steady-state error is reduced by 4.3%.