Hepatopulmonary syndrome (HPS) increases the mortality of patients who suffered from liver cirrhosis, especially patients plagued by severe hypoxemia. Gene polymorphisms are reported to be related to the risk of HPS in cirrhotic patients. Thus, our study aims to elucidate the correlation between MMP‐2 and MMP‐9 gene polymorphisms and HPS in cirrhotic patients. A total of 152 cirrhotic patients suffering from HPS as well as another 152 cirrhotic patients without HPS were recruited. Polymerase chain reaction‐restriction fragment length polymorphism (PCR‐RFLP) was performed for MMP‐2 and MMP‐9 gene polymorphisms and logistic regression analysis for the relationship between clinicopathological features and HPS occurrence in cirrhotic patients. There were significant differences in genotype and allele frequency of MMP‐2 rs243865 and MMP‐9 rs3918242 polymorphisms between the HPS and control groups. CC/CT genotype and C allele of MMP‐2 rs243865 polymorphism as well as CC/TT genotype and T allele of MMP‐9 rs3918242 polymorphism increased the risk of HPS in cirrhotic patients. Genotypes of rs243865 and rs3918242 polymorphisms had remarkable correlations with spider nevi, clubbed fingers (toes), transaminase elevation, portal vein width, esophageal varices, Child‐Pugh classification and partial pressure of arterial oxygen (PaO2). Logistic regression analysis showed that rs243865 and rs3918242 polymorphisms, spider nevi, clubbed fingers (toes), esophageal varices, and Child‐Pugh classification were closely associated with the occurrence of HPS in cirrhotic patients. Our findings demonstrate that MMP‐2 rs243865 polymorphism and MMP‐9 rs3918242 polymorphism can increase the risk of HPS occurrence in cirrhotic patients, which provides a potential target for prevention of HPS in cirrhotic patients.