Ionic liquid functionalized tungsten disulfite nanosheets (IL-WS2) were prepared by using 1-vinyl-3-(3-aminopropyl)-imidazolium bromide (VAPimBr) ionic liquid as an auxiliary reagent to exfoliate WS2 bulk crystals in N-methyl pyrrolidone with ultrasonication. Hollow gold nanospheres (HGNs) were controllably synthesized by using 1,3-di(3-bromopropyl)-imidazolium bromide ionic liquid as the functional monomer. HGNs were integrated onto IL-WS2 nanosheet surface to fabricate a HGNs/IL-WS2 nanocomposite through the interaction between S and Au atoms. VAPimBr ionic liquid and HGNs can significantly enhance the photocurrent response of IL-WS2 nanosheets. Human epididymis protein 4 antibody (anti-HE4) was immobilized onto the HGNs/IL-WS2 nanocomposite modified glassy carbon electrode (GCE) surface. Followed by being treated with glutaraldehyde vapor and bovine serum albumin (BSA), a photoelectrochemical immunosensor for human epididymis protein 4 (HE4) was successfully constructed and denoted as anti-HE4/HGNs/IL-WS2/GCE. The photoelectrochemical variation upon interacting with HE4 was used for the quantitative assay. Experimental conditions including the exfoliation time, the amount of VAPimBr ionic liquid, HGNs size, ascorbic acid concentration, incubation time, incubation temperature have been optimized. Under optimal conditions, HE4 was determined by using the photoelectrochemical immunosensor in a dynamic linear range from 0.1 pg mL−1 to 10 ng mL−1 with a detection limit of 0.03 pg mL−1 (S/N = 3). HE4 in clinical serum samples were also accurately determined with satisfied results.