Sofosbuvir is used with other antiviral medications (such as ribavirin, peginterferon, daclatasvir) to treat chronic (long-lasting) hepatitis C, a viral infection of the liver. It works by reducing the amount of hepatitis C virus in your body, which may help your liver recover.