Aiming at the problem of low localization accuracy in Distance Vector-Hop (DV-Hop) algorithm, a localization algorithm based on adaptive PSO algorithm was proposed for wireless sensor networks. First of all, through single jumped average error correction average distance, and then using the average jump from receiving much of the anchor node estimate the distance between the nodes, to optimize estimated distance, the adaptive particle swarm optimization algorithm was used to optimize the position of the unknown node coordinates obtained by least square method, avoid APSO algorithm using adaptive operator algorithm trapped in local optimum, and get the global optimal. Simulation results show that the proposed algorithm is better than DV-Hop algorithm and PSO-DVHop algorithm in positioning accuracy under different anchor ratio, node number and communication radius.