An increased interest in energy-efficient communication protocols to extend battery life and improve network scalability has resulted from the fast growth of Internet of Things (IoT) devices, especially Narrowband IoT (NB-IoT) devices. In this study, we suggest a unique method of sleep scheduling using machine learning techniques for NB-IoT networks. Our method seeks to optimize energy usage while maintaining responsive connection by dynamically adjusting the sleep patterns of NB-IoT devices depending on anticipated network activity levels. Using machine learning algorithms trained on historical data gathered from NB-IoT devices and base stations, the suggested process entails developing a prediction model. In order to produce real-time estimates of future network demand, the model analyzes a variety of input parameters, including as the surrounding environment, traffic patterns, and the closeness of the device to the base station. The sleep scheduling mechanism, which coordinates the sleep-wake cycles of NB-IoT devices to coincide with expected periods of low activity, is informed by these forecasts. We illustrate the efficacy of our machine learning-based sleep scheduling technique in attaining noteworthy energy savings while maintaining network performance, utilizing comprehensive simulations and real-world tests. We are able to strike a compromise between energy economy and responsiveness by cleverly scheduling sleep, which keeps NB-IoT devices operational for their monitoring and control functions while preserving battery life. Our study addresses the increasing need for sustainable IoT solutions in smart city settings and beyond by advancing energy-efficient communication protocols for NB-IoT networks. The suggested method opens the door for more effective and durable IoT ecosystems by providing useful advice and insights for applying machine learning-based sleep scheduling algorithms in actual IoT installations.