Lane departure warning system used in vehicles has recently become very popular and is about to become a vital component in advanced driver assistance systems. The performance of this system is directly related to lane detection accuracy. In this study, a fuzzy inference system-based filter for robust lane detection is proposed. The proposed filter has three input parameters which are as follows: the difference between a pixel and its left and right neighbours at a certain distance along the horizontal direction and standard deviation of the pixels between the left and right neighbours. The parameters of the proposed fuzzy filter are determined in a learning phase by taking challenging scenarios such as varying lighting conditions, shadows, and road cracks. Experimental results reveal that the proposed method outperforms existing lane detection filters when integrated into a lane detection system. Since the proposed approach is computationally lightweight, it is suitable for real-time devices and applications.