In this paper, the problem of opportunistic spectrum sharing for the next generation of wireless systems empowered by the cloud radio access network (C-RAN) is studied. More precisely, low-priority users employ cooperative spectrum sensing to detect a vacant portion of the spectrum that is not currently used by high-priority users. The authors' aim is to maximize the overall throughput of the low-priority users while guaranteeing the quality of service of the high-priority users. This objective is attained by optimally adjusting spectrum sensing time, with respect to target probabilities of detection and false alarm, as well as dynamically allocating C-RAN resources, that is, powers, sub-carriers, remote radio heads, and base-band units. To solve this problem, which is non-convex and NP-hard, a low-complex iterative solution is proposed. Numerical results demonstrate the necessity of sensing time adjustment as well as effectiveness of the proposed solution.