The demand for high bandwidth on the Internet is growing drastically, and one of the solutions for tackling this problem is using optical networks. Burst switching is one of the techniques that can be used in optical networks to handle high traffic. Aside from many advantages that this technique has, it suffers from a big flaw called burst contention. Optical Burst Switching (OBS) is a switching technique without any buffering system. As a result, when two bursts are trying to reserve one resource, one of them drops. This drawback can have a significant impact on the performance of some protocols like TCP because they have not been designed to perform in a network without any queuing system and cannot distinguish a drop is because of the congestion or contention. In this paper, a new algorithm called AVGR (Average of RTTs) is proposed based on some mathematical equations to prevent the degradation of TCP. It tries to calculate averages for some RTTs in three different periods. Then base on the obtained results, the congestion control mechanism will be modified. The primary goal of the algorithm is to determine the current status of the network and make proper decisions based on it.