In a wireless sensor network (WSN), sensor nodes monitor the physical environment and forward the collected data to a data sink for further processing. Sensors are battery powered and, therefore, prolonging the lifetime of their batteries is critically important. In a rechargeable WSN (RWSN), prolonging the battery lifetime of sensors is achieved through reducing communication energy and recharging the batteries periodically. Reducing the communication energy consumption is done through choosing the best forwarding sensors (i.e., routing) for data collected by each sensor and deciding the transmission power of each sensor (i.e., power allocation). Recharging the batteries is achieved through harvesting energy from external sources. In this thesis, we consider a RWSN that uses wireless power transfer as the energy harvesting technology and jointly optimizes charging and communications in order to minimize the power consumption of the RWSN.