In cognitive radio networks, knowledge of the position of the primary users is very important as it can be used to avoid harmful interference to the primary users, while at the same time be exploited to improve the spectrum utilization. In this paper, a semi range-based localization algorithm is proposed for the secondary users in cognitive radio networks to estimate the positions of the primary users. The basic idea of the proposed algorithm is to take advantage of the estimated detection probabilities, which can be obtained from the binary detection indictors of the secondary users, in order to estimate the distances between themselves and the primary users. The accuracy of the proposed localization algorithm is further improved by introducing an iterative least squares algorithm. The Cramer- Rao lower bound of the mean square error of the proposed localization estimator is also derived. Extensive simulations will then show that the actual mean square error achieved by the proposed localization algorithm is reasonably close to the lower bound, which demonstrates that the proposed method is near optimal.