Research on nodes localization in Wireless Sensor Networks (WSN) has been a hot spot in recent years. How to improve the reliability and accuracy of nodes localization is a hard and challenging problem in the area, and is far to be solved satisfactorily. This paper proposes an effective self-adapting localization algorithm in WSN based on optimized RSSI and DV-Distance algorithm. In order to enhance the precision of localization, the presented algorithm introduces an effective method to reduce the error of RSSI-measured distance. The algorithm also uses Small-World-Network theory to help select beacon nodes from localized normal nodes, so as to raise the performance and efficiency. Experimental results show that the algorithm has effectively improved the accuracy, self adaptivity, performance and efficiency of nodes localization in WSN.