Abstract-Total least squares (TLS) is a popular solution technique for overdetermined systems of linear equations, where both the right-hand side and the input data matrix are assumed to be noisy. We consider a TLS problem in an ad hoc wireless sensor network, where each node collects observations that yield a node-specific subset of linear equations. The goal is to compute the TLS solution of the full set of equations in a distributed fashion, without gathering all these equations in a fusion center. To facilitate the use of the dual-based subgradient algorithm (DBSA), we transform the TLS problem to an equivalent convex semidefinite program (SDP), based on semidefinite relaxation (SDR). This allows us to derive a distributed TLS (D-TLS) algorithm, that satisfies the conditions for convergence of the DBSA, and obtains the same solution as the original (unrelaxed) TLS problem. Even though we make a detour through SDR and SDP theory, the resulting D-TLS algorithm relies on solving local TLS-like problems at each node, rather than computationally expensive SDP optimization techniques. The algorithm is flexible and fully distributed, i.e., it does not make any assumptions on the network topology and nodes only share data with their neighbors through local broadcasts. Due to the flexibility and the uniformity of the network, there is no single point of failure, which makes the algorithm robust to sensor failures. Monte Carlo simulation results are provided to demonstrate the effectiveness of the method.