Insomnia is associated with fatigue and poor driving performance, thus increasing the risk of traffic accidents. This study aimed to evaluate the effect of fatigue on driving in patients with chronic insomnia in a free-flow traffic scenario and car-following scenario, and to investigate the relationships between driving performance, cognitive function, and insomnia. The Trail Making Test (TMT), Stroop Color and Word Test (SCWT), Symbol Digit Modalities Test (SDMT), and Digit Span Test (DST) of 15 participants with mild-to-moderate chronic insomnia and 16 healthy participants were assessed. During the fatigue driving task, drivers completed simulated driving tasks under free-flow traffic and car-following scenarios. The mean speed (MS), mean acceleration (MA), mean lateral position (MLP), and standard deviation of lateral position (SDLP) were measured to assess driving performance. During fatigued tasks, the MA and MLP in the free-driving scenario were higher than those in the car-following scenario (P < 0.01), the SDLP was higher in the insomnia group than in the healthy group (P = 0.02), and the interaction effect was significantly different for MLP between the groups (P = 0.03). MS was negatively correlated with TMT score, SDMT score, and DST score, and positively correlated with time to complete TMT, errors in SCWT, and time to complete SCWT. SDLP was negatively correlated with DST score and positively correlated with time to complete SCWT. Furthermore, the insomnia group had poorer lateral vehicle control ability than the healthy group. The insomnia group had a more impaired driving performance in the free-driving scenario than in the car-following scenario. Drivers with impaired cognitive function exhibited impaired driving performance.