Due to the limited energy of wireless sensor networks (WSNs), improving energy efficiency and prolonging network lifetime are the key issues of WSNs application. In this paper, we proposed a cluster routing protocol based on energy-aware affinity propagation(CAP). The CAP protocol enhances network performance from three aspects. First, an energy-aware affinity propagation clustering algorithm is proposed, which finds the optimal network clustering topology taking into account the total network energy consumption and load balancing. Second, an inter-cluster relay selection method is proposed for CH relay selection in multi-hop routing. At last, the energy threshold re-cluster scheme is applied to avoid frequent re-clustering that consumes a large amount of energy. The simulation experiments are conducted in two sink node deployment scenarios: sink external(case 1) and central(case 2) deployment. The results indicate that our proposed CAP outperforms LEACH, LEACHC, and KCE in terms of energy efficiency and network lifetime. In case 1, the first node death of the proposed CAP algorithm occurs in 1114 rounds, which is 61.4%, 64.5%, and 33.3% longer compared to LEACH, LEACHC, and KCE, respectively. In case 2, the first node death of the CAP algorithm occurs in 1372 rounds, which is 68.8%, 31.9%, and 49.8% longer compared to LEACH, LEACHC, and KCE, respectively.