Bradysia odoriphaga (Diptera: Sciaridae) is a serious pest of Chinese chives cultivated in China. Chemosensory proteins (CSPs) are important components of insect olfactory systems that capture and bind environmental semiochemicals which are then transported to olfactory receptors. Despite their importance, the mechanism of olfaction and related behavioral processes in B. odoriphaga have not been characterized. Here, we found that BodoCSP4 has an important olfactory function. RT-qPCR indicated that BodoCSP4 expression was highest in the heads (antennae removed) of adult males, followed by the antennae of adult males. Competitive binding assays with 33 ligands indicated that BodoCSP4 binds well with methyl allyl disulfide, diallyl disulfide, and n-heptadecane; the corresponding dissolution constants (Ki) were as high as 5.71, 5.71, and 6.85 μM, respectively. 3D-structural and molecular docking indicated that BodoCSP4 has five α-helices and surrounds the ligand with certain hydrophobic residues including Leu60, Leu63, Leu64, Ala67, Val28, Ile30, Ile33, Leu34, and Val86, suggesting these residues help BodoCSP4 bind to ligands. Silencing of BodoCSP4 significantly decreased the attraction of B. odoriphaga males to diallyl disulfide and n-heptadecane but not to methyl allyl disulfide in Y-tube olfaction assays. These results increase our understanding of how BodoCSP4 contributes to host and female localization by B. odoriphaga males.