This paper exploits the tradeoff between data quality and energy consumption to extend the lifetime of wireless sensor networks. To obtain an aggregate form of sensor data with precision guarantees, the precision constraint is partitioned and allocated to individual sensor nodes in a coordinated fashion. Our key idea is to differentiate the precisions of data collected from different sensor nodes to balance their energy consumption. Three factors affecting the lifetime of sensor nodes are identified: 1) the changing pattern of sensor readings; 2) the residual energy of sensor nodes; and 3) the communication cost between the sensor nodes and the base station. We analyze the optimal precision allocation in terms of network lifetime and propose an adaptive scheme that dynamically adjusts the precision constraints at the sensor nodes. The adaptive scheme also takes into consideration the topological relations among sensor nodes and the effect of in-network aggregation. Experimental results...