Wireless Body Area Networks(WBANs) is one of the most attractive communication technologies in recent years. Herein, network lifetime acts as a key factor in various WBANs applications. In this paper, an adaptive energy-aware relay mechanism is proposed to improve the network lifetime performance of WBANs based on the framework specified in IEEE 802.15.6 protocol. The proposed mechanism considers the energy-level of each node in the network to adaptively adjust the topology of the network in order to conserve the nodes which are lack of energy. The mechanism consists of two stages which are initialization phase and update phase. The update phase in the mechanism can be invoked by either enquiry method or report method to efficiently make relay selection for the network and reform the topology according to the varying network conditions. As a consequence, WBANs can make full use of residual energy in the network to improve the lifetime of WBANs. The simulation results show that the proposed mechanism can effectively prolong the network lifetime comparing with the original star topology strategy and other relay mechanisms proposed for WBANs. In addition, a scenario is designed where a sensor node in the network has the ability of moving to illustrate the capability of our mechanism to support mobility of sensor nodes.