Most sensor network applications require quality of service guarantees on a network-wide basis, suggesting the need for global network cost optimization. The dynamic and nonuniform local states of individual nodes in sensor networks complicate global cost optimization. Here, we present an approach for optimizing global cost in sensor networks through greedy local decisions at each node, and we explore the benefits of this approach in reducing the idle listening at individual nodes in order to reduce the global network energy cost. We consider two representations for the local sensor node state: (1) number of descendants in the routing tree; and (2) number of descendants and duty cycle. For both state representations, we show through experiments on a testbed of 14 mica2 sensor nodes running ALPL that enabling nodes to set their listening mode according to their local state reduces global energy cost by 35% and provides more balanced energy consumption over the case of BMAC.