Congestion control is an important research area in wireless mesh network(WMN). In order to solve congestion control in WMN, a random routing algorithm based on path weights (WA) is presented. The algorithm adopts multi-gateway wireless mesh network routing protocol to solve the congestion problem of single gateway. And anycast service was used to ensure the successful rate of service requests. Simulation results show that WA is the better algorithm as it has less average wait time and the successful rate of service requests. The algorithm can effectively solve congestion problem, and make the network stable and efficient.