Cognitive radio is a technology developed for the effective use of radio spectrum sources. The spectrum sensing function plays a key role in the performance of cognitive radio networks. In this study, a new threshold determination method based on online learning algorithm is proposed to increase the spectrum sensing performance of spectrum sensing methods and to minimize the total error probability. The online learning algorithm looks for the optimum decision threshold, which is the most important parameter to decide the presence or absence of the primary user, using historical detection data. Energy detection- and matched filter-based spectrum sensing methods are discussed in detail. The performance of the proposed algorithm was tested over non-fading and different fading channels for low signal-to-noise ratio regime with noise uncertainty. In the conclusion of the simulation studies, improvement in spectrum sensing performance according to optimal threshold selection was observed.