Wireless sensor networks are widely deployed for a wide range of data gathering applications such as collecting environmental information, collecting military data, and monitoring large buildings. However, the limited energy of the sensor nodes requires efficient gathering of information so that the network lifetime is increased. In literature it is proved that this efficiency can be achieved by clustering the sensor nodes in the network. In this paper, we present a new robust genetic algorithm for forming dynamic clusters in sensor networks. The proposed genetic clustering algorithm (GCA) takes into consideration the energies and the distance between the nodes to form efficient clusters. The algorithm aims at forming well-balanced clusters so that the load is balanced in the network. The algorithm can be applied in scenarios where a central node controls the sensor network and requires efficient clustering. Simulation results show that the algorithm forms balanced clusters that increase the network lifetime by having minimum energy dissipation in the network. Results are also compared with other clustering protocols and it is shown that GCA has lesser node deaths and more data signals sent to the base station.