The data aggregation rate is presented to denote the compressing capability of a sensor node in the sensor networks, and the distributed algorithm is proposed based on data aggregation to achieve an optimal routing scheme that maximizes the network lifetime. The problem is formulated as a linear programming problem, and sub-gradient algorithm is used to solve it in a distributed manner. The simulation results show that the proposed algorithm can reduce data traffic, balance energy consumption, and prolong the network lifetime effectively.