Cognitive radio wireless sensor networks (CR-WSNs) are a type of WSNs that use cognitive radio technology to enhance the spectrum utilization and energy efficiency. This paper proposes an energy-efficient resource allocation algorithm (EERAA) to prolong the lifetime of a WSN-based smart irrigation system under realistic scenarios. In the proposed algorithm, power allocation and subcarrier assignment are performed consecutively. Considering the impact of the intercarrier interference (ICI) caused by timing offset, the problem of maximizing network-averaged capacity is formulated considering power and interference constraints in realistic scenarios. The obtained results reveal that the proposed algorithm attempts to maximize the averaged capacity of the CR-WSN subject to the total power constraint and tolerable interference. Numerically, the proposed algorithm can reduce the network energy consumption by up to 30%, compared with conventional approaches, while maintaining a high level of system performance in terms of secondary users’ (SUs) averaged capacity.