There is a way to prolong the life of sensor networks according to which a hierarchical routing algorithm is used intelligently, which employs all network elements in data transmission. Clustering the nodes is one of the best methods that can significantly increase the network life. Making a cluster, selecting a Cluster Head (CH) and data transmission in Wireless Sensor Network (WSN) are the issues that affect energy consumption. Software-Defined Networks (SDN) are a modern network architecture that distinguishes the network control panel from the data plate also this architecture cause the network utilizing is increased, and the operational cost is reduced. This method also causes creativity and perfection in the network area. Moreover, the possibility of implementing management protocols, including traffic management, which is an inevitable part of networks, can be implemented in SDN with a higher level of flexibility. In this paper, the CH has selected trough game theory, which sends data with the help of game theory rewards and calculating the geographical location of other nodes. Then, high-priority data is sent according to the proposed algorithm with the help of game theory. The simulation results in NS3 software show that the proposed method has obtained acceptable results compared with Artificial Bee Colony algorithm (ABC), Genetic Algorithm (GA), Cuckoo Search algorithm (CS), Firefly algorithm (FA) and Grey Wolf Optimization Algorithm (GWO).