Localization technology performs an essential part in wireless sensor networks (WSNs). The Distance vector hop (DV-Hop) localization algorithm has been frequently used in the WSNs with its simplicity, feasibility and minimal hardware requirements. However, the low localization accuracy of the DV-Hop algorithm has limited its further application in WSNs. To overcome the accuracy problem of the DV-Hop algorithm, we propose an improved DV-Hop algorithm based on topological structure similarity, called TDSDV-Hop. Different from the traditional DV-Hop algorithm, the topological structure similarity is applied to correct the hop count, reducing the inaccuracy caused by the minimum hop count. The hop counts will be converted from discrete to precise continuous values by the topological structure similarity. In this paper, firstly, the topological structure similarity is defined, followed by the proof of the theory that the distance between two nodes is inversely proportional to the topological structure similarity. Secondly, a hop-correction equation that can correct the hop count between neighbor nodes is set up. Then the TDSDV-Hop algorithm incorporates hop-correction formula and simulates the optimal hop-correction parameters in order to acquire more accurate values of the hop count. And the coordinates of unknown nodes are calculated by the least square method. Finally, the levy adaptive improved bird swarm algorithm (LSABSA) is utilized to optimize coordinates of unknown nodes by constructing a new objective function. The simulation results show that the localization performance of the TDSDV-Hop algorithm is better than that of DV-Hop, GWODV-Hop, CRWDV-Hop and CVLR algorithm in terms of localization accuracy, localization time and communication cost.