In this paper, we investigate a joint power allocation and relay selection scheme for energy efficient cooperation in energy harvesting-wireless sensor networks (EH-WSN). We mainly propose a simple heuristic algorithm to improve the energy efficiency of each node in a clustering based EH-WSN. First, the effect of cooperative communication is evaluated, and then, the energy sustainability of every node is taken into account, finally, we formulate an online optimization problem which can be solved near optimally with low computational complexity. Extensive simulation results are presented to show the outstanding performance of our proposed scheme in nodes' transmitting power allocation and average working utility. Therefore, this joint optimization algorithm has a promising future in real applications.