Nowadays, grid‐tied solar photovoltaic (SPV) and electric vehicles (EV) are escalating owing to the large penetration of EVs into the transportation sector. In addition, the battery energy storage system benefits the EV application by ensuring power under varying supplies. In this proposed work, the honey badger optimization algorithm (HBOA) is used for energy management in battery‐connected solar PV. The battery scheduling is done by controlling the DC link voltage using HBOA. The HBOA has better exploration and exploitation behavior; thus, it could not be trapped in the local optima, and the deviation in voltage can be reduced. In the grid‐integrated PV system, DC into AC conversion should concern power quality (PQ) and switching frequencies. The static synchronous compensator (STATCOM) is connected at the grid side to address this issue. The STATCOM provides rapid regulation of dynamic powers to minimize the harmonics and voltage unbalances. This work proposes the fuzzy fractional order proportional integral derivative (F2OPID) to enhance voltage regulation and reactive power (RP) compensation. The proposed work is implemented on the MATLAB/Simulink tool, and the results are evaluated using existing methods. The results indicate that the proposed method improves the PQ with a lower total harmonic distortion (THD) of 0.76% for voltage and 0.79% for current, respectively.