In wireless sensor networks, scheduling the sleep duration of each node is one of the key elements for controlling critical performance metrics such as energy consumption and latency. Since the wakeup interval is a primary parameter for determining the sleeping schedule, how to tune the wakeup interval is crucial for the overall network performance. In this paper, we present an effective framework for tuning asynchronous wakeup intervals of IEEE 802.15.4 sensor networks from the energy consumption viewpoint. First, we derive an energy consumption model of each node as an explicit function of the wakeup interval, and empirically validate the derived model. Second, based on the proposed model, we formulate the problem of tuning the wakeup interval with the following two objectives: to minimize total energy consumption and to maximize network lifetime. We show that these two problems can be optimally solved by an iterative algorithm with global information by virtue of the convexity of the problem structure. Finally, as practical solutions, we further propose heuristic optimization algorithms that only exploit local information. In order to develop heuristic algorithms, we propose two broadcasting schemes, which are entitled as maximum wakeup interval broadcasting and efficient local maximum broadcasting. These broadcasting algorithms enable nodes in the network to have heterogeneous wakeup intervals.Index Terms-Sensor networks, energy saving MAC, IEEE 802.15.4 MAC, distributed optimization.