Wireless network is composed of sensor nodes. Sensor nodes are deployed in harsh physical environment to gather data and deliver the data to the remote base station. Sensor nodes have irreplaceable energy source, limited computational capability and limited memory. Therefore, it is a challenge to maximize the use of energy of these sensor nodes to extend the network lifetime. This study proposes a Rank-Based Data Gathering Algorithm for wireless sensor networks. Sensor nodes are randomly distributed in a network field of different sizes.