Internet of Things (IoT) is expected to vastly increase the number of connected devices. As a result, a multitude of IoT devices transmit various information through wireless communication technology, such as the Wi-Fi technology, cellular mobile communication technology, low-power wide-area network (LPWAN) technology. However, even the latest Wi-Fi technology is still ready to accommodate these large amounts of data. Accurately setting the contention window (CW) value significantly affects the efficiency of the Wi-Fi network. Unfortunately, the standard collision resolution used by IEEE 802.11ax networks is nonscalable; thus, it cannot maintain stable throughput for an increasing number of stations, even when Wi-Fi 6 has been designed to improve performance in dense scenarios. To this end, we propose a CW control strategy for Wi-Fi 6 systems. This strategy leverages deep learning to search for optimal configuration of CW under different network conditions. Our deep neural network is trained by data generated from a Wi-Fi 6 simulation system with some varying key parameters, e.g., the number of nodes, short interframe space (SIFS), distributed interframe space (DIFS), and data transmission rate. Numerical results demonstrated that our deep learning scheme could always find the optimal CW adjustment multiple by adaptively perceiving the channel competition status. The finalized performance of our model has been significantly improved in terms of system throughput, average transmission delay, and packet retransmission rate. This makes Wi-Fi 6 better adapted to the access of a large number of IoT devices.