This study presents an optimal online control that implements a biogeography-based optimization (BBO) algorithm on a battery energy system (BES) integrated into an energy-stored quasi-impedance source inverter (qZSI) that connects a photovoltaic (PV) power plant to the grid. The BBO algorithm was used to tune the PI regulator in the BES current control loop by minimizing the integral time absolute error (ITAE). Two different options for the BBO are compared in this application:1) a PI controller with online self-tuning based on BBO, and 2) a PI controller with offline tuning using BBO. Moreover, the BBO-based PI controllers were compared with a third controller tuned online using the particle swarm optimization (PSO) algorithm. To evaluate and compare the controllers, a PV power plant with a battery energy-stored qZSI was simulated under different operating conditions, such as step changes in the BES current reference, different sun irradiance, and a grid voltage sag. The results demonstrate better control of the BES current with the online tuning techniques (BBO and PSO) than with the offline tuning procedure, and similar results between the two online tuning algorithms. Nevertheless, throughout the simulation, the time of use of the BBO algorithm was almost 2.5 times smaller than the PSO algorithm. Therefore, the online BBO-based PI controller is considered the most suitable option.