A simple solid-phase microextraction technique using molecularly imprinted polymers (MIP-SPME) was prepared to monitor phenobarbital in urine samples. In this technique, the fiber was prepared via insertion of the modified stainless-steel wire in the reaction solution including 3- aminopropyltriethoxysilane and tetraethyl orthosilicate in the presence of an acidic catalyst (acetic acid). The fabricated MIP-SPME fiber was utilized to selectively extract phenobarbital from urine samples and prepare it for detection through high-performance liquid chromatography with ultraviolet detection. The synthesized MIPs were characterized by several techniques such as Fourier-transform infrared spectroscopy, field emission scanning electron microscopy, and thermal gravimetric analysis. The effects of various influencing factors on the extraction yield of phenobarbital were considered and optimized. The conditions that yielded the maximum extraction efficiency were as follows: pH of 5, 25 min extraction time, 500 rpm stirring rate, 15 min desorption time and using methanol as elution solvent. Within the range of concentrations of 0.02 to 100 μg mL−1, the method had linear characteristics, with a suitable coefficient of determination (0.9983). We determined limits of detection and limits of quantification to be 9.88 and 32.9 ng mL−1, respectively. The repeatability and reproducibility of the prepared fibers were 4.6 and 6.5%, respectively.