In wireless sensor networks (WSNs), when a stimulus or event is detected within a particular region, data reports from the neighboring sensor nodes (sources) are sent to the sink (destination). Data from these sources are usually aggregated along their way to the sink. The data aggregation via in-network processing reduce communication cost and improves energy efficiency. In this paper, we propose two different tree structures to facilitate data aggregation. We first propose E-Span, which is an energy-aware spanning tree algorithm. In E-span, the source node which has the highest residual energy is chosen as the root. Other source nodes choose their corresponding parent node among their neighbors based on the information of the residual energy and distance to the root. We also propose the Lifetime-Preserving Tree (LPT). In LPT, nodes which have higher residual energy are chosen as the aggregating parents. LPT also includes a self-healing feature by which the tree will be re-constructed again whenever a node is no longer functional or a broken link is detected. By choosing Directed Diffusion [C. Intanagonwiwat, R. Govindan, D. Estrin, Directed diffusion: a scalable and robust communication paradigm for sensor networks, in: Proc. of ACM MobiCom'00, Boston, MA, Aug. 2000, pp. 56-67.] as the underlying routing platform, simulation results show that in a WSN with 250 sensor nodes, the lifetime of sources can be extended significantly when data are aggregated by using either E-Span or LPT algorithms.