Lysozyme (Lys) plays crucial roles in the innate immune system, and the detection of Lys in urine and serum has considerable clinical importance. Traditionally, the presence of Lys has been detected by immunoassays; however, these assays are limited by the availability of commercial antibodies and tedious protein modification and prior sample purification. To address these limitations, we report here the design, synthesis, and application of a competition-mediated pyrene-switching aptasensor for selective detection of Lys in buffer and human serum. The detection strategy is based on the attachment of pyrene molecules to both ends of a hairpin DNA strand, which becomes the partially complementary competitor to an anti-Lys aptamer. In the presence of target Lys, the aptamer hybridizes with part of the competitor, which opens the hairpin such that both pyrene molecules are spatially separated. In the presence of target Lys, however, the competitor is displaced from the aptamer by the target, subsequently forming an initial hairpin structure. This brings the two pyrene moieties into close proximity to generate an excimer, which, in turn, results in a shift of fluorescence emission from ca. 400 nm (pyrene monomer) to 495 nm (pyrene excimer). The proposed method for Lys detection showed sensitivity as low as 200 pM and high selectivity in buffer. When measured by a steady-state fluorescence spectrum, the detection of Lys in human serum showed a strong fluorescent background, which obscured detection of the excimer signal. However, time-resolved emission measurement (TREM) supported the potential of the method in complex environments with background fluorescence by demonstrating the temporal separation of probe fluorescence emission decay from the intense background signal. We have also demonstrated that the same strategy can be applied to the detection of small biomolecules such as adenosine triphosphate (ATP), showing the generality of our approach. Therefore, the competition-mediated pyrene-switching aptasensor is promising to have potential for clinical and forensic applications.