In this paper, the optimal data aggregation routing for maximizing the network lifetime in wireless sensor networks(WSNs) is investigated. By analyzing network traffic and power consumption, a network flow model is proposed for data aggregated WSNs. Maximum lifetime and network flow model are combined to design a group of mixed integer programming cost function. The approximate optimal relay transmission rate and data aggregation routing are obtained by utilizing the dual decomposition method. The simulation results show that the proposed algorithm can reduce data traffic, balance energy consumption, and prolong the network lifetime effectively.