A semiconductor structure includes an n-type epitaxial source/drain feature (NEPI) and a p-type epitaxial source/drain feature (PEPI) over a substrate, wherein a top surface of the NEPI is lower than a top surface of the PEPI. The semiconductor structure further includes a metal compound feature disposed on the top surface of the NEPI and the top surface of the PEPI; a contact feature disposed on the metal compound feature and over both the NEPI and the PEPI; and a via structure disposed over the contact feature and over the NEPI, wherein the via structure is partially in the contact feature.