ZigBee hierarchical tree routing protocol (HRP; ZigBee Alliance, San Ramon, CA, USA) provides a simple but reliable topology. However, the transmission routes are not always efficient, and the links are fixed after they were determined during the network initialization. In this paper, we propose an adaptive routing optimization and energy-balancing algorithm in ZigBee hierarchical networks. In our routing algorithm, the parent node could adaptively maintain its child's links for lower network load, and all the information needed can be obtained from a neighbour table to avoid introducing extra communication overhead. Such algorithm makes ZigBee's hierarchical topology to adaptively maintain and optimize the routing paths during its lifetime, and an address reassignment mechanism is also introduced to ensure that our algorithm follows ZigBee specification. In addition, an energy-balancing algorithm is also proposed to reduce the power cost of low-battery device. Simulation results show that our routing scheme has better performance with lower average transmission hops and network load, and our energy-balancing algorithm could reduce the power consumption of low-battery device.