The localization accuracy can be degraded considerably due to the existence of non-line of sight(NLOS) propagation between the sensor nodes in indoor environment. Therefore, the NLOS node localization method is investigated for wireless sensor networks. The objective function is established according to the measurement models of beacon nodes and LOS(line of sight) propagation probability in different environment. The particle swarm optimization method is employed to estimate the position of the unknown node, and the least square method is used to compute the node position as the initial position of the particle. The simulation results show that the proposed method has higher localization accuracy in comparison with the least square method, the residual weighting algorithm(Rwgh) and random sample consensus(RANSAC) methods.