In this paper, we propose a new congestion control algorithm called CoCoA to address the issue of network congestion in Internet of Things (IoT). Unlike the existing congestion control mechanisms that operate on instantaneous Round Trip Time (RTT) measurements in IoT, we use delay gradients to get a better measure of network congestion, and implement a probabilistic backoff to deal with congestion. We integrate the delay gradients and the probability backoff factor with Constrained Application Protocol (CoAP). The proposed algorithm is implemented and evaluated using the Cooja network simulator provided by Contiki OS. Subsequently, it is deployed and evaluated in a real testbed by using the FIT/IoT-LAB. We observe that delay gradients give a more accurate measure of congestion and the Retransmission Time Out (RTO) is reduced significantly, thereby leading to less delays and high packet sending rates. CoCoA being a minor improvement over the existing algorithm is easy to deploy.