In wireless sensor networks (WSNs), energy efficiency is critical for increasing network lifetime. WSNs consist of low-cost nodes with constrained energy. Present study demonstrates that data aggregation is an effective approach to reduce energy consumption in WSNs. Current data aggregation algorithms, such as cluster-based, tree-based, and chain-based data aggregation algorithm, incur high overhead to maintain structures and in dynamic scenarios incur much more cost to continuously reconstruct aggregate route. In this paper, we propose a dynamic virtual force-based algorithm (VFE) for data aggregation which can adapt to different scenario changes. Inspired by the concept of cost field and virtual force, VFE constructs dynamic routing without structure overhead, which makes data aggregation more efficient. The simulations confirm that VFE achieves significant energy saving and prolongs network lifetime.