The rapid advancement in Wireless Sensor Network (WSN) technology has enabled smart environments to provide ubiquitous real-time applications in various fields such as industry, smart city, transport, health and Internet of Things (IoT). Energy is the most significant resource in WSNs as it has a direct effect on their lifetime. The efficient use of energy is required for the lifetime extension of WSNs. One of the well-known methods for achieving high scalability and efficient resource allocation in WSN is a clustering of sensor nodes. In this paper, the Chicken Swarm Optimization based Clustering Algorithm (CSOCA) is proposed to improve energy efficiency in WSNs. The chicken swarm optimization is discretized by applying a sigmoid function to individuals. Moreover, we proposed CSOCA with Genetic Algorithm (CSOCA-GA) which is an improvement to CSOCA by employing the Genetic Algorithm's processes in CSOCA. CSOCA-GA utilizes crossover and mutation processes for individuals with low fitness value to extend the population diversity. CSOCA and CSOCA-GA are tested and compared with other similar algorithms to confirm their effectiveness in terms of extending WSN lifetime and reducing energy consumption. INDEX TERMS Wireless sensor network, clustering, Internet of Things, genetic algorithm, chicken swarm optimization.