Conventional 802.11 medium access control (MAC) protocols have been designed separately from the characteristics of the physical layer so as to simplify the analysis, but this hardly optimizes the overall performance from a system point of view. In this paper, we propose a channel state based random access protocol that takes advantage of multi-packet reception (MPR) in IEEE 802.11-like wireless local area networks (WLANs). Specifically, the proposed MAC protocol dynamically adjusts each node's transmission probability according to the network population, current channel condition, as well as the maximum number of packets that can be decoded simultaneously. We shall derive the system throughput by taking adaptive modulation and transmission errors into consideration. An optimal transmission policy is then obtained to achieve the maximum throughput. It is shown that our proposed approach can significantly increase the throughput without sacrificing system resources such as bandwidth and transmission energy, compared to the schemes using conventional models.