To solve the problem that the nonlinear impedance of photovoltaic energy storage system has great bad effect on the grid-connected characteristics, an adaptive optimization method of PID controller with particle swam algorithm for grid-connected inverter in photovoltaic energy storage system is proposed in this paper. The model of photovoltaic storage power generation system is built to estimate the grid-connected characteristic of the system. Grid voltage proportional fed-forward and phase-locked loop (PLL) are adopted for the grid-connected inverter, and adaptive PID controller is used for the inverter and the parameters are optimized with particle swarm algorithm (PSO). A simulation model is established with the optimized parameters, the characteristics about the current harmonics of the grid-connected inverter before and after the modification with the proposed method are compared, the comparison results show that the proposed method can effectively suppress the background harmonics and ensure that the grid current follows the phase of the grid voltage.