Aiming at the deficiencies of current matching algorithm based on AIS (Artificial immune system), such as fault positive is high and the efficiency is very low, an improved evolution optimization with r-continuous bits matching rule was proposed. The concepts and formal definitions of immune cells were given, affinity accumulation process, and mature-lymphocyte lifecycle were presented. This new algorithm introduces evolution operator into the matching rule during the affinity accumulation process to improve the detection efficiency and overcome the shortcoming of the local optimum. Experimental results showed that the algorithm greatly enhances the response rate and the precision of detection, and the proposed model has the features of real-time processing, self-adaptively, thus providing a promising solution for intrusion detection.