Both the backoff time and idle listening are the key issues affecting the performance of wireless sensor networks. Therefore, the energy-efficient and traffic-adaptive Z-medium access control protocol is proposed in this study. Firstly, it avoids idle listening by setting a fixed contention window in single round to effectively improve the fairness in the backoff strategy. At the same time, it ensures the nodes with less residual energy have priority to access channel and realise the load balance. Secondly, the protocol uses the improved explicit contention notification (ECN) mechanism to reduce the energy consumption caused by sending the ECN messages repeatedly in a period of time and prolong the network lifetime. Lastly, the channel flags are introduced at the top of data frames to make an appointment on the channel so as to avoid the idle listening. Simulation results show that, when, compared with other similar algorithms, the collision rate is reduced by at least 14.2%, the time when the first node dies is prolonged by at least 135 rounds, and the average network energy consumption is reduced by at least 23%.