The Internet of Things (IoT) has transformed modern life by connecting a wide range of devices and systems; however, it also presents significant security challenges. Intrusion detection systems (IDS) are crucial for identifying and mitigating threats in IoT environments, but their effectiveness is often compromised by imbalanced datasets, diverse attack types, and varying device characteristics. The ToN IoT dataset's complexity, which includes binary and multi-class classifications, further complicates accurate attack detection. Traditional IDS techniques struggle to address these issues. Imbalanced data can lead to biased detection results, with certain attack types being underrepresented or overlooked. Additionally, the diversity of IoT devices makes achieving reliable intrusion detection more difficult. This research developed three techniques to tackle challenges a large number of features, extensive datasets, data quality issues, and imbalanced classes in both binary and multi-class classifications. The first technique employed the XGBoost and LightGBM algorithms to solve a binary classification problem across seven different datasets. The second technique also utilised XGBoost and LightGBM but focused on a multi-class classification problem using the TON IoT dataset. The final technique aimed to enhance the accuracy achieved in the second technique by addressing imbalanced classes in multi-class intrusion detection for IoT using XGBoost, LightGBM, and the ADASYNMLP approach. The results indicated that this approach effectively addresses several key challenges. In conclusion, the study demonstrated that the three proposed techniques significantly improve accuracy through optimised results, deliver high computational speed, and enhance overall performance. The approach overcomes previous limitations that hindered the generalizability of the findings, showcasing superior capability in providing more accurate and efficient intrusion detection.