Data aggregation algorithms play a primary role in WSN, as it collects and aggregates the data in an energy efficient manner so that the life expectancy of the network is extended. This paper intends to develop a query-based aggregation model for WSN using the advanced optimization algorithm called group search optimization (GSO). The proposed model is constructed in such a way that the querying order (QO) can be ranked based on latency and throughput. Accordingly, the main objective of the proposed GSO-based QO is to minimize the latency and maximize the throughput of WSN. The proposed data aggregation model facilitates the network administrator to understand the best queries so that the performance of the base station can be improved. After framing the model, it compares the performance of GSO-based QO with the traditional PSO-based QO, FF-based QO, GA-based QO, ABC-based QO and GSO-based QO in terms of idle time and throughput. Thus the data aggregation performance of proposed GSO-based QO is superior to the traditional algorithms by attaining high throughput and low latency.