This paper proposes a bio-inspired clustering algorithm based on the bacteria foraging optimization (BFO) approach to enhance the energy efficiency and network lifetime of wireless sensor networks (WSNs). It discusses various routing protocols, issues related to deployment, energy consumption, and optimal clustering strategies to improve signal strength and reduce data loss. The results from simulations indicate that the BFO algorithm performs better than traditional clustering methods like LEACH and K-means in terms of energy dissipation and overall network performance.