We present a novel method for detecting the intima and adventitia of carotid artery in B-mode sonographic images. This method simultaneously detects both layers with the anatomic information of these layers to reduce the influence of noises. We have tested the method on images made from different sonographic instrumentation. A comparison between automatic detection and professional manual tracing is performed. The results show that this method can be applied directly on these instrumentation with few modifications.