According to different sizes of wireless sensor network (WSN), we propose a novel backoff algorithm of self-adaptive optimal contention window (SA-LL). The algorithm uses the number of nodes of competitive channel as logarithm function parameter, it not only dynamically adjusts contention window to optimal value but also makes the trend of backoff more reasonable. At the same time, the algorithm uses probability of transmission for linear parameter. It not only effectively resolves the disadvantages of BEB algorithm that it doesn't record the current congestion and backoff times but also improves the problem of slowly linear change of MILD algorithm. Simulation results show that the algorithm can accurately estimate the congestion of the network and can improve the performances of the throughput, delay and fair.