Insomnia is one of the most common diseases in elderly patients, which seriously affect the quality of life and psychological state of patients. The purpose of this study was to investigate the changes in the functional network pattern of the prefrontal cortex in patients with chronic insomnia disorder (CID) after taking drugs, using non-invasive and low-cost functional neuroimaging with multi-channel near-infrared spectroscopy (fNIRS). All subjects were assessed using the Pittsburgh Sleep Quality Index (PSQI), Hamilton Depression Scale (HAMD), Hamilton Anxiety Scale (HAMA), and fNIRS. The fNIRS assessment consists of two parts: the verbal fluency test (VFT) task state and the resting state, which assessed the differences in prefrontal activation and functional connectivity, respectively. A total of 30 patients with chronic insomnia disorder (CID) and 15 healthy peers completed the study. During the VFT task, a significantly lower PFC activation was observed in patients with insomnia compared to the control group (P < 0.05). However, the PFC activation in patients taking medication was higher than in patients who did not receive medication. Functional connectivity analysis showed a weaker mean PFC channel connectivity strength in patients with CID who did not receive drug treatment. Drug treatment resulted in enhanced functional connectivity of the prefrontal lobe, especially the DLPFC and frontal poles. A weak prefrontal cortex response was detected in patients with CID when performing the VFT task, which could be enhanced by taking hypnotics. The weakened right prefrontal lobe network may play a role in the development of CID. fNIRS may serve as a potential tool to assess sleep status and guide drug therapy.