Internet of Things (IoT) gadget proliferation has resulted in unprecedented connectedness as well as simplicity, but it has raised serious security concerns. Botnet attacks can threaten the security, integrity and accessibility of critical data and services and IoT networks are susceptible to them. To increase the security to identify botnet attacks in IoT networks, this study suggests a model based on a Parallel Gradient Descent Optimized Four Layered Network (PGDOFLN).We gathered the CICIDS2017 dataset from Kaggle, which is used to train and assess the proposed model. Using a robust scalar to handle missing values allows for the normalization of data, the t-distributed stochastic neighbor embedding (t-SNE) technique is utilized for extracting the feature and the LASSO method is used for feature selection. This study on attack detection is based on PGDOFLN and uses a Python program. The simulated results showed that the suggested method outperforms existing methods with an accuracy (0.95), recall (0.95), precision (1.00), and f1 score (0.97). This study supports continuing attempts to protect IoT networks and safeguard private information, vital infrastructure, and sensitive data.