In wireless sensor networks as the nodes work by limited battery power, life time is an important concern. In this paper a routing protocol to elongating the network lifetime is proposed. This protocol has two stages to construct the spanning tree on the nodes; at the first step the spanning tree start construction from the main sink (root). Second round start working and do some correction on the tree so the final spanning tree has nodes with fewer branches. The simulations result shows that the proposed algorithm cause to distribute energy consumption more balanced between nodes and prolonging the network lifetime up to 80% when TDMA protocols is running and 7% when S-MAC is running in Data link layer and network has low traffic.