The low-cost Wireless Sensor Network (WSN) consists of small battery powered devices called sensors, with limited energy capacity. Once deployed, accessibility to any sensor node for maintenance and battery replacement is not feasible due to the spatial scattering of the nodes. This will lead to an unreliable, limited lifetime and a poor connectivity network. In this paper a novel bio-inspired cluster-based deployment algorithm is proposed for energy optimization of the WSN and ultimately to improve the network lifetime. In the cluster initialization phase, a single cluster is formed with a single cluster head at the center of the sensing terrain. The second phase is for optimum cluster formation surrounding the inner cluster, based on swarming bees and a piping technique. Each cluster member distributes its data to its corresponding cluster head and the cluster head communicates with the base station, which reduces the communication distance of each node. The simulation results show that, when compared with other clustering algorithms, the proposed algorithm can significantly reduce the number of clusters by 38% and improve the network lifetime by a factor of 1/4.