The main issue is that photovoltaic (PV) systems have their power output reduced due to partial shading. Less energy is produced by photovoltaic modules when partial shading causes an imbalance in the levels of irradiation. Array reconfigurations, both static and dynamic, are suggested as a strategy to improve power capture and reduce the impact of partial shading. Furthermore, it is recognized that irradiance fluctuations, snow, ice, and dust are environmental elements that impact the efficiency of PV arrays. Using white shark optimization (WSO), this research introduces a new method for optimizing the power reconfiguration of PV arrays. Minimizing the disparity in row currents and maximizing power production are the main goals of this WSO-based technique. Four different types of shade patterns are considered in the research: short wide (SW), long wide (LW), short narrow (SN), and long narrow (LN). In order to confirm that this method works, we ran simulations in MATLAB-Simulink and compared the outcomes to those of other configurations, such as Total Cross Tied (TCT), Butterfly Optimization Algorithm (BOA), Harris Hawks Optimization (HHO), and Flower Pollination Algorithm (FPA). Simulation results show the effectiveness of the WSO method in enhancing power extraction from the PV array, especially under partial shading conditions. Notably, the WSO method significantly increases the Global Maximum Power (GMP) output across different scenarios: by 26.22% in SW, 18.51% in LW, 10.95% in SN, and 10% in LN. This confirms the ability of this method to improve the PV power generation in diverse operating environments.