In Wireless Sensor Networks (WSNs), current intrusion detection systems (IDSs) work in isolation from access control. The lack of interoperation between these components can not provide enough security for WSNs. To address this, we propose a new framework to integrate access control and intrusion detection (ID) to improve the security of WSNs. Moreover, we perform access control based on usage control (UCON), so that our scheme can provide mutable attributes and continuous access decision. We also develop an adaptive decision tree construction mechanism for intrusion detection. Besides normal attacks, our scheme can defense against sophisticated ongoing attacks and unknown attacks in WSNs. An instance of policy is simulated to evaluate the overhead coursed by our scheme. The implementation results support the feasibility of using our scheme in WSNs. Also, the security evaluation is done. The results show that the proposed scheme can provide higher security than traditional security schemes.