The localization problem of nodes in wireless sensor networks is often the focus of many researches. This paper proposes an opposition-based learning and parallel strategies Artificial Gorilla Troop Optimizer (OPGTO) for reducing the localization error. Opposition-based learning can expand the exploration space of the algorithm and significantly improve the global exploration ability of the algorithm. The parallel strategy divides the population into multiple groups for exploration, which effectively increases the diversity of the population. Based on this parallel strategy, we design communication strategies between groups for different types of optimization problems. To verify the optimized effect of the proposed OPGTO algorithm, it is tested on the CEC2013 benchmark function set and compared with Particle Swarm Optimization (PSO), Sine Cosine Algorithm (SCA), Whale Optimization Algorithm (WOA) and Artificial Gorilla Troops Optimizer (GTO). Experimental studies show that OPGTO has good optimization ability, especially on complex multimodal functions and combinatorial functions. Finally, we apply OPGTO algorithm to 3D localization of wireless sensor networks in the real terrain. Experimental results proved that OPGTO can effectively reduce the localization error based on Time Difference of Arrival (TDOA).