Wireless Sensor Network (WSN) has broad prospects for development. At the same time, the limitation of node energy and non-rechargeable character of the node restrict WSN extensive application. Thus, clouds particle swarm algorithm combined with clustering method for optimizing WSN clumping process was proposed in this study. Cloud Particle Swarm Optimization (CPSO) algorithm can quickly and accurately search the optimal clustering method, double layers means that the whole network is divided into two layers of cluster structure. It realizes the balanced energy consumption and the energy conservation, avoids network black hole caused by the network energy consumption imbalances and prolongs the network life cycle. The simulation results show that the algorithm can save energy in certain application environment, balance node energy consumption and prolong the network survival cycle.