By cognitive radio technology, secondary users (SUs) can use licensed bands opportunistically without causing interferences to primary users (PUs). Spectrum sensing is performed by SUs to detect that PUs are present or not. Therefore, spectrum sensing is a key technology for cognitive radio (CR), and sensing time is a critical parameter for spectrum sensing performance. The longer sensing time can result in a higher sensing accuracy. However, it will lead to occupying data transmission period, and consuming higher energy in spectrum sensing. In this paper, a novel spectrum sensing scheme is proposed to guarantee both of the sensing accuracy and energy efficiency. In the proposed scheme, SU will dynamically decide to perform spectrum sensing one or two periods according to the sensing result of the current frame for guaranteeing the sensing accuracy. Furthermore, in order to guarantee the network energy efficiency, the spectrum sensing time is optimized through the mathematical model of the secondary network. Simulation results validate that the energy efficiency and miss detection probability of SU can be improved significantly by the proposed scheme.