Abstract-Body sensor networks (BSNs) and WiFi networks have been widely investigated due to the availability of sensor motes and WiFi devices, but they are commonly deployed separately. In this paper we propose to optimize the total communication energy consumption of BSN and WiFi (BSN-WiFi) networks using joint data rate adaptation. More specifically, we first elaborate the BSN-WiFi network system in four consecutive phases. Then based on the system, we analyze the communication energy consumption, throughput and time delay, and provide a signal-to-noise ratio and packet delivery ratio (SNR-PDR) mappings of BSN and WiFi networks. Next, we build an energy optimization model with constraints of SNR-PDR mappings, throughput, and time delay to minimize the total communication energy consumption in BSN-WiFi networks. With the input of SNR values, we solve this model by cvx to obtain the output of optimal data rates associated with SNR values, which are then tabulated for online data rate adaptation. Finally, we collect 20-minute traces from a specific BSN-WiFi network system for performance evaluation, and the results demonstrate that our optimal data rate solution achieves up to 86% energy savings comparing with the solutions using fixed data rates.