Data aggregation has been emerged as a basic approach in wireless sensor networks (WSNs) in order to reduce the number of transmissions of sensor nodes. In this paper, we propose an energy-efficient model based on improved BP neural network by particle swarm optimization (PSO-BPNN) in WSNs. The global optimized initial weights and threshold of BP network are obtained by PSO. And then PSO-BPNN is deployed at both the base station (BS) and the node in WSNs, helps to find out potential laws according to historical data sets. Only when the deviation between the actual and the predicted value at the node exceeds a certain threshold, the sampling value and new model are sent to BS. The experiments on ocean surface temperature 2008 made a satisfied performance. When the error threshold greater than 0.05degC, it can decrease more than 80% data transmissions.