With the continuous prevalence of wireless sensor network (WSN) applications in the recent days, localization of sensor nodes became an important aspect in research in terms of its accuracy, communication overhead and computational complexity. Localization plays an important role in location sensitive applications like object tracking, nuclear attacks, biological attacks, fire detection, traffic monitoring systems, intruder detections, and finding survivors in post-disasters, etc. The objective of localization is to identify the coordinates of target nodes using information provided by anchor nodes. Precision improvement of the sensor node positions is a key issue for an effective data transmission between sensor nodes and save the node’s energy as well as enhance the network lifetime. In this article, a cost-effective localization algorithm with minimal number of anchor nodes is proposed that uses nature inspired optimization techniques to enhance the localization accuracy compared to the state-of-the-art localization algorithms. The performance metrics considered for simulations and comparison with the existing algorithms include average localization accuracy, communication range, and the number of anchor nodes. The simulation results prove that the proposed gaussian-newton localization through multilateration algorithm (GNLMA) enhances the mean localization accuracy to 92.8% and the range measurement error is limited to 1.22meters. Depending on the communication range of sensor nodes, the average localization accuracy is achieved up to 94.4% using the proposed GNLMA.