Wireless body area sensor networks (WBASNs) have received growing attention from industry and academia due to their exceptional potential for patient monitoring systems that are equipped with low-power wearable and implantable biomedical sensors under communications standards such as IEEE 802.15.4-2015 and IEEE 802.15.6-2012. The goal of WBASNs is to enhance the capabilities of wireless patient monitoring systems in terms of data accuracy, reliability, routing, channel access, and the data communication of sensors within, on and around the human body. The huge scope of challenges related to WBASNs has led to various research publications and industrial experiments. In this paper, a survey is conducted for the recent state-of-art in the context of medium access control (MAC) and routing protocols by considering the application requirements of patient monitoring systems. Moreover, we discuss the open issues, lessons learned, and challenges for these layers to provide a source of motivation for the upcoming design and development in the domain of WBASNs. This survey will be highly useful for the 6th generation (6G) networks; it is expected that 6G will provide efficient and ubiquitous connectivity to a huge number of IoT devices, and most of them will be sensor-based. This survey will further clarify the QoS requirement part of the 6G networks in terms of sensor-based IoT.