Being aware of the nodes positions is a key issue in order to locate precisely the sensor node, localization is very important information about sensor nodes in wireless sensor network (WSNs). Hence, the precision improvement is a significant issue that allows an effective data transmission between sensor network (SN) in order to save their energy and extend the network lifetime. In this work, we propose and implement a new mechanism for geographic routing. Therefore, the proposed mechanism is relied on a weighted centroid localization technique, where the positions of unknown nodes are calculated using fuzzy logic method. For this, we propose a fuzzy localization algorithm that uses flow measurement through wireless channel to compute the distance separating the anchor and the sensor nodes. Subsequently, our work is based on the centroid algorithm that calculates the position of unknown nodes using fuzzy Mamdani and Sugeno inference system for increasing the accuracy of estimated positions. Once the localization algorithm has detected the location of nodes with unknown position, the proposed mechanism selects effectively the next-elected CH to reduce the energy dissipation of sensor nodes, which leads to an extension of the network lifetime. The main advantages of the proposed mechanism are three folds: the first is to minimize the position error of nodes and reduces the error localization average. The second is to increase the number of packets transmitted to the next hop cluster head (CH) based on the localization algorithm. The third one is to, reduce the energy consumption of nodes and then extends the network lifetime using an efficient selection of next hop CH. The obtained simulation results show that the proposed mechanism outperforms the existing solutions in terms of energy consumption, execution time (localization time) and localization error, similarly for the number of the packets transmitted to the base station.