One of the most crucial tasks in wireless sensor networks (WSN) is to determine the locations of sensory nodes as they may not all be equipped with GPS receivers. In this paper, an improved algorithm called Monte Carlo localization weighted by similarity (MCWS) is proposed. MCWS optimizes the sampling area of Monte Carlo localization (MCL) by adopting the mobile node's location based on the received signal strength indicator (RSSI) as the new sampling center. The signal values are stored as a target sequence, and by comparing the similarity between samples' sequences and the target sequence, samples can be filtered. Also the similarity values are used as the weighted standards to calculate coordinate of the mobile node. Extensive simulation results confirm that the new localization approach outperforms other MCL algorithms. The MCWS algorithm reduces the localization error by 1%~10% under different density of beacon nodes and by 30%~40% under different maximum speed of mobile nodes, respectively.