The wireless sensor network is widely used in the Internet of Things. As its core technology, the clustering routing algorithm effectively prolongs the network life cycle. An energy balance algorithm for heterogeneous wireless sensors based on bilevel decision and data distribution is proposed. Firstly, a more suitable cluster head is selected through the bilevel decision-making and competition mechanism. Secondly, A multi-objective decision-making strategy is used to synthesize multiple factors for data distribution. It can be seen from the simulation results that the routing algorithm has a great improvement in the network life cycle, energy utilization rate and data transmission.