As a classic clustering algorithm, LEACH is widely used in wireless sensor networks. Due to the random cluster head selection process, LEACH does not guarantee optimization for the number and position of cluster heads. In order to further optimize LEACH, an optimal energy-efficient cluster-heads selection algorithm LEACH-G for LEACH protocol is presented. The authors calculate the optimal number of cluster heads based on energy model for LEACH algorithm, and further set forth on LEACH-G algorithm for optimal cluster heads. They use NS2 simulation platform to compare LEACH-G with LEACH.