Wireless sensor networks consist of a large number of nodes which are distributed sporadically in a geographic area. The energy of all nodes on the network is limited. For this reason, providing a method of communication between nodes and network administrator to manage energy consumption is crucial. For this purpose, one of the proposed methods with high performance, is clustering methods. The big challenge in clustering methods is dividing network into several clusters that each cluster is managed by a cluster head (CH). In this paper, a centralized genetic-based clustering (CGC) protocol using onion approach is proposed. The CGC protocol selects the appropriate nodes as CHs according to three criteria that ultimately increases the network life time. This paper investigates the genetic algorithm (GA) as a dynamic technique to find optimum CHs. Furthermore, an innovative fitness function according to the specified parameters is presented. Each chromosome which minimizes fitness function, is selected by base station (BS) and its nodes are introduced to the whole network as proper CHs. After the selection of CHs and cluster formation, for upper level routing between CHs, we define a novel concept which is called Onion Approach. We divide the network into several onion layers in order to reduce the communication overhead among CH nodes. Simulation results show that the implementation of the proposed method by GA and using onion approach, presents better efficiency compared with other previous methods. Conducted simulation results show that the CGC protocol has done significant improvement in terms of running time of the algorithm, the number of nodes alive, first node death, last node death, the number of packets received by the BS, and energy consumption of the network.