In the current literature on cognitive radio, it is commonly assumed that fixed time durations are assigned for spectrum sensing and data transmission. It is however possible to improve the performance by finding the best tradeoff between sensing time and network throughput. In this paper, we formulate the sensing-throughput problem to dynamically assign a number of SUs for cooperatively sensing each channel and calculate the optimal sensing time such as to maximize the total average throughput of SUs in the presence of interference with PUs. We propose a two-step optimization algorithm to optimize sensing time and the number of assigned SUs to each channel. Simulation results demonstrate that significant improvement in the throughput of SUs is achieved when the sensing time and the number of assigned SUs is jointly optimized.