Network congestion happens if the source traffic load exceeds the maximal transport capacity at any point in a network. For wireless sensor networks, the node-level congestion leads to a large amount of packet drop, causes the transport capacity to degrade, and increases the network latency. Particularly, more packet retransmissions under network congestion waste the limited energy of network nodes, and shorten the network system lifetime. However, the end-to-end congestion control in wired networks is not appropriate to wireless sensor networks, due to the radio channel and the traffic pattern in wireless sensor networks. In this paper, a node-level congestion avoidance algorithm for wireless sensor networks is proposed. The proposed algorithm consists of two parts, one is the sending window based congestion avoidance and the other is the priority based packet sending strategy. Under the proposed algorithm, every sensor node assigns a sending window for each upstream node by some strategies, and the upstream node which obtains available sending window sends the packet with the highest priority in order to improve the network performances, such as fairness and latency. The simulation results show that the proposed algorithm is energy-efficient, not only reducing the packet drop rate over networks, but also improving effectively the network transport fairness and the average network latency.