The molecular imprinting technique is a new method for preparing molecularly imprinted polymers (MIPs) with specific molecular recognition sites for individual target molecules. In this study, Ag2S-MIP-TiO2 nanocomposite was synthesized by a sol-gel-deposition method with ethyl p-hydroxybenzoate as an imprinting molecule. The obtained powder was characterized by XRD and other analytical methods. The results show that the obtained Ag2S-MIP-TiO2 nanocomposite demonstrates better catalytic performance than pure anatase TiO2. The degradation efficiency of ethyl p-hydroxybenzoate during 1.5 h of the photocatalytic reaction is 92.22%, which is 42% higher than pure TiO2. The selectivity factor for the treatment of ethyl p-hydroxybenzoate compared to phenol using Ag2S-MIP-TiO2 reached 3.571, which is 72% higher than pure TiO2.