Cognitive Radio (CR) is an intelligent technique for opportunistic access of idle resources. In CR, Spectrum sensing is one of its important key functionalities. It is used to sense the unused spectrumin an opportunistic manner. Energy detection constitutes a preferred approach for spectrum sensing in cognitive radio due to its simplicity and applicability. The conventional energy detection technique, which is based upon fixed threshold, is sensitive to noise uncertainty which is unavoidable in practical cases. This noise uncertainty gets the fixed threshold energy detector un-optimized in its performance. In this paper, an efficient energy detector is proposed for optimal CR performance. The proposed scheme is based upon a dynamic threshold energy detection algorithm, in which, the decision threshold is toggled between two levels based upon the average energy received from the primary user (PU) during a specified period of observation. Thresholds evaluations are based upon estimating the noise uncertainty factor. These thresholds are used to maximize the probability of detection (Pd) and minimize the probability of false alarm (Pfa). Theoretical analysis and simulation results show the effectiveness of the proposed scheme in comparison to the conventional energy detection method with less increase in complexity.