The paper presents a routing algorithm that maximizes the lifetime of a sensor network in which all data packets are destined for a single collection node. Lifetime is maximized by adjusting the number of packets traversing each node. The adjustment is carried out by transmitting over alternative routes. The first part of the paper assumes that the worst case delay resulting from energy efficient routing is less than the maximum tolerable value. Ignoring the delay constraint of the network, the routes are selected as the solution to a linear programming (LP) problem in which the objective is to maximize the minimum lifetime of each node. The solution is implemented in a centralized algorithm, and then approximated by an iterative algorithm based on least cost path routing, in which each step is implemented efficiently in a distributed manner. The second part of the paper incorporates delay guarantee into energy efficient routing by constraining the length of the routing paths from each sensor node to the collection node. Simulations reveal that the lifetime of the network increases significantly by optimal routing, and including delay constraint in energy efficient routing improves the network performance since the delay of the network keeps increasing as the delay constraint is relaxed beyond the value at which the optimal lifetime is achieved.