Wireless Sensor Networks (WSNs) have been employed in various real-time applications and addressed fundamental issues, such as limited power resources and network life. Several sensor nodes in a WSN monitor the actual world and relay discovered data to base stations. The biggest issue with WSN is that the sensors have a limited lifetime and use much electricity to relay data to the base station. This paper proposes an improved PSO-based Enhanced Distributed Energy Efficient Clustering (EDEEC) algorithm to extend the network's life and reduce power consumption. Clustering is the process of forming groups of sensor nodes. The cluster aims to improve the network's scalability, energy efficiency, and other characteristics. The particle swarm optimization algorithm is modified to obtain energy-efficient WSNs. The assessment is based on the essential WSN characteristics, including network lifetime and energy efficiency (power consumption). Compared to LEACH, HEED, and DEEC, our proposed IPSO-EDEEC uses less energy.