Most of the recent proposed particle swarm optimization (PSO) algorithms do not offer the alternative learning strategies when the particles fail to improve their fitness during the searching process. Motivated by this fact, we improve the cutting edge teaching–learning-based optimization (TLBO) algorithm and adapt the enhanced framework into the PSO, thereby develop a teaching and peer-learning PSO (TPLPSO) algorithm. To be specific, the TPLPSO adopts two learning phases, namely the teaching and peer-learning phases. The particle firstly enters into the teaching phase and updates its velocity based on its historical best and the global best information. Particle that fails to improve its fitness in the teaching phase then enters into the peer-learning phase, where an exemplar is selected as the guidance particle. Additionally, a stagnation prevention strategy (SPS) is employed to alleviate the premature convergence issue. The proposed TPLPSO is extensively evaluated on 20 benchmark problems with different features, as well as one real-world problem. Experimental results reveal that the TPLPSO exhibits competitive performances when compared with ten other PSO variants and seven state-of-the-art metaheuristic search algorithms.