We consider the combined energy management and rate control problem in wireless sensor networks (WSNs) with energy harvesting (EH) capability. In our previous work, we have established that the energy management problem can be viewed as a queue control problem, where the objective is to control the energy queue to a reference level based on predictions of energy to be harvested. In this work, we consider the problem of controlling both the energy and the data queue. The energy queue is controlled by adjusting the capacity of the data queue, while the data queue is controlled by adjusting the advertised rate at the network users which are assumed to be compliant with and without delay. We assume linear models of the data and energy queues and controllers are derived respectively. We demonstrate that the rate control problem, in the presence of a well controlled energy queue, can be reduced to a queue control problem with varying link capacity and we discuss the design options emanating from such a consideration. The stability of the combined control policy is established analytically. Further, we consider an arbitrary network case and we address global stability problem in the case of time varying capacity as a result of the energy variations.