Massive tremendous amount of miniaturized wireless Internet of Things (IoT) devices are widely employed in many fields such as industrial production, social life, public (and defense) security and management of human society. The limitation of node device's energy capacity is the bottleneck issue of these network systems. MAC protocol is a key communication protocol for such sensor nodes which both rationally saves energy (an alternative to energy harvesting way) and improves the performances of the wireless sensor networks. There are complex tradeoff optimization relationships between the size of contention window and energy consumption, delay and collision, in which too large or too small contention window value cannot make the network performance optimal. This paper firstly gives an optimization algorithm for the size of the contention window through theoretical analysis, which can achieve a compromise between energy consumption (i.e. alternative energy harvesting) and delay. Then, a global view based adaptive contention window (GV-ACW) MAC protocol is proposed to further reduce latency and improve alternative energy harvesting. The GV-ACW MAC protocol adopts the optimized size of contention window in the near sink area to meet the functional requirements of data forwarding, while in the far sink area, the size of contention window is larger than it required by node for data transmission so as to reduce the latency and thereby improve the network performance as a whole. The theoretical analysis and experimental results show that, comparing with previous MAC protocol, GV-ACW protocol can realize effective alternative energy harvesting which resulting increasement of the network lifetime by 6% and reduce the network delay by 15%.INDEX TERMS Wireless sensor networks, alternative energy harvesting, size of contention window, delay, lifetime, Internet of Things.