Node localization is an important supporting technology in wireless sensor networks (WSNs). Traditional maximum likelihood estimation based localization methods (MLE) assume that measurement errors are independent of the distance between the anchor node and a target node. However, such an assumption may not reflect the physical characteristics of existing measurement techniques, such as the widely used received signal strength indicator. To address this issue, we propose a distance-based MLE that considers measurement errors that depend on distance values in this paper. The proposed distance-based MLE is formulated as a complicated nonlinear optimization problem. An exact solution is developed based on first-order optimal condition to improve the efficiency of search. In addition, a two-dimensional search method is also presented. Simulation experiments are performed to demonstrate the effectiveness of this localization. The simulation results show that the distance-based localization method has better localization accuracy compared to other range-based localization methods.