To provide high-precision positioning for Internet of Things (IoT) scenarios, we optimize the indoor positioning technique based on Ultra-Wideband (UWB) Time Difference of Arrival (TDOA) equipment. This paper analyzes sources of positioning error and improves the time synchronization algorithm based on the synchronization packet. Then we use the labels of the known position to further optimize the time synchronization performance, and hence improve TDOA measurements. After time synchronization optimization, a Weighted Least Square (WLS) and Taylor coordination algorithm is derived. Experiments show that our optimization reduces the average positioning error from 54.8 cm to 12.6 cm.