Congestion in wireless sensor networks occurs when traffic load allocated to any sensor node is beyond its capacity. To support traditional quality of service like packet loss ratio, packet delay, wasting energy and throughput, congestion has to be controlled in the wireless sensor networks. To do this, a distributed congestion control algorithm is used for tree based communications. For each node, fair and efficient transmission rate is assigned. In this algorithm, aggregate output and input traffic rate is monitored in each node. Based on difference of the two, a node decides to increase or decrease the bandwidth allocable to a flow originating from itself and the flow is being routed through it.