Extending the network lifetime as long as possible is one of the critical issues for wireless sensor networks (WSNs), which is usually resolved by using clustering and routing protocols. The clustering and routing processes are considered as an NP-hard problem popularly solved by swarm intelligence optimization algorithm. In this paper, a novel particle swarm optimization based clustering and routing protocol called NPSOP is proposed to maximize the network lifetime considering not only energy efficiency but also energy and load balance. In NPSOP, the particle swarm optimization (PSO) technique is used to select the cluster heads (CHs) and find the routing paths for each CH by encoding them into a single particle simultaneously. Moreover, the components of a particle is constrained by parameters residual energy, centrality, distance to the BS so as to improve the convergence speed. In addition, the fitness function considering network energy consumption and load balancing is derived to evaluate the quality of particles. And an adaptive inertial weight is used to update the status of each particle in order to escape from trapping into local optima. Iteratively, the global optimal solution can be reached in the end. The performance of NPSOP is evaluated by extensive experiments compared with existing approaches in terms of energy consumption, throughput, network lifetime, standard deviation of residual energy and load. The results show that NPSOP outperforms its comparatives.