Traditional range query methods of work still have shortcomings in node energy consumption and privacy security, so a two-layer secure and efficient range query method for wireless sensor networks is proposed. In the data storage stage, the sensing node obtains the data ciphertext and timestamp by the Advanced Encryption Standard encryption algorithm, receives the new encryption constraint chain by the reverse 0-1 encoding method and Hashbased Message Authentication Code encryption algorithm, and sends the chain to the storage node. In the query response phase, the storage node responds to the request of the base station and sends the data that meet the query requirements. After receiving the data, the base station verifies the consistency with the new encryption constraint chain and timestamp. During the experiment, the energy consumption is analysed from three aspects: the number of data collected in the period, the data length of the sensing node and the partition factor of the encryption constraint chain. The results show that this method has low energy consumption and can maintain the consistency of data.This is an open access article under the terms of the Creative Commons Attribution-NonCommercial-NoDerivs License, which permits use and distribution in any medium, provided the original work is properly cited, the use is non-commercial and no modifications or adaptations are made.