To keep pace with the current rapid evolution of mobile data requirements, IEEE 802.11 was evolved to provide more desirable performance to fulfill the needs of fifth-generation (5G) and Internet of Things (IoT) networks. It provides two different access contention-based schemes; Distributed Coordination Function (DCF) which not differentiates between different services, and Enhanced Distributed Channel Access (EDCA) which provides differentiation between various services through four priority Access Categories (ACs). The dilemma of the conventional IEEE 802.11 networks is the static assignation of parameters in DCF and EDCA regardless of the number of associated stations and no matter what kind of service is required by each station (i.e., the activity of ACs). Consequently, this led to a significant degradation in the performance of the network, especially in the case of ultra-dense load network. Therefore, in this paper, we introduce a novel algorithm for EDCA considering a dynamic assignation of Arbitration Inter-Frame Space Number (AIFSN) and guidance Contention Window (CW) depending on the number of associated stations and ACs activeness status. Based on the analytical models of EDCA, a game-theoretic method is proposed to make each associated station adapts its transmission probability within the guidance CW. The purpose of guidance CW is a pre-stage to detect the selfish stations which pick up a very low CW to maximize its throughput regardless of the overall network throughput. Simulation results show that the proposed game-based algorithm can obtain higher performance than the standard 802.11 networks in terms of normalized throughput, data dropped during retransmissions limit threshold exceeding, and mean average delay for sensitive delay applications. INDEX TERMS EDCA, high density WLANs, multiple access, selfish nodes, 5G.