This paper proposes an enhanced method for localizing sensor nodes in wireless sensor networks with obstacles. Such environment settings lead to lower localization accuracy because locations are estimated based on detour distances circumventing the obstacles; we, therefore, improve the segmentation technique to address the issue as they divide the whole area into multiple smaller ones, each containing fewer or no obstacles. Nevertheless, when radio transmissions between sensor nodes are obstructed (as simulated by the radio irregularity model), the signal-strength variation tends to be high, reducing localization accuracy; thus, we provide a method for accurately approximating the distances between pairs of an anchor node (whose location is known) and an unknown node by incorporating the related error into the approximation process. Additionally, when the nodes with unknown locations are outside the polygon formed by the anchor nodes, the search area for localization is relatively large, resulting in lower accuracy and a longer search time; we then propose a method for reducing the size of approximation areas by forming boundaries based on the two intersection points between the ranges of two anchor nodes used to localize an unknown node. However, these reduced search areas could still be large; we further increase the accuracy of the PSO location estimation method by adaptively adjusting the number of particles. In addition, with PSO, the accuracy of unknown node location estimation depends on having a properly selected fitness function; therefore, we incorporate appropriate variables to reflect the distance approximation accuracy between each anchor-unknown node pair. In experiments, we measure performance in sensor node deployment areas of three different shapes: C-shaped, with 1 hole, and with 2 rectangular holes. The results show that our method provides higher localization accuracy than others in small-, medium-, and large-scaled WSNs. Specifically, our proposed method is 27.46%, 49.28%, 50.33%, and 74.62% more accurate on average than IDE-NSL, PSO–C, min-max PSO, and niching PSO, respectively.