This study aims to evaluate the application value of contrast-enhanced transthoracic echocardiography (cTEE) in the diagnosis of patent foramen ovale (PFO) under different states of stimulation, with the goal of enhancing the accuracy and efficiency of PFO diagnosis. This research consecutively enrolled patients suspected of having PFO from October 2022 to February 2024, presenting primary clinical symptoms such as unexplained syncope, headache, dizziness, and stroke. Patients underwent standard transthoracic echocardiography (TTE) and cTEE under three different states of stimulation (resting state, coughing, and Valsalva maneuver). Based on the presence of microbubbles in the left heart and their initial appearance time, patients were classified into PFO and control groups, with further diagnostic confirmation via transesophageal echocardiography (TEE) or foramen ovale closure procedures. The study results revealed significant differences between the PFO and control groups regarding age (p = 0.034) and headache symptoms (p = 0.001). In the PFO group, TTE showed a higher positivity rate both at rest and during coughing, highlighting the association between PFO and specific clinical symptoms. The number of microbubbles observed during TTE increased significantly under various stimulation states, particularly during the Valsalva maneuver (p < 0.05). This increase became more pronounced as the duration of the maneuver was extended, underscoring the differential response of PFO patients under varied physiological testing conditions, especially during prolonged Valsalva maneuvers. The study confirms the significant value of cTEE in diagnosing PFO under different stimulation states, particularly emphasizing the application of the Valsalva maneuver to significantly improve the sensitivity and specificity of PFO detection. Thus, incorporating cTEE examinations under various stimulation states holds significant clinical importance for enhancing the accuracy and efficiency of PFO diagnosis.