Prognosis of hepatocellular carcinoma (HCC) is generally poor. The role of modifiable lifestyle factors on HCC survival has been less studied. To examine whether prediagnosis smoking and alcohol affected HCC survival stratified by viral etiology, we conducted a prospective cohort study of 2,273 (1990 with viral hepatitis and 283 without) incident HCC cases aged 20–75 years who were enrolled between 1997 and 2004 from a Taiwanese multicenter study, and followed up through 2007. Information on habitual smoking and alcohol consumption was obtained at baseline through personal interview. After follow-up to a maximum of 10 years, 1,757 participants died and 1,488 (84.7%) were attributed to HCC. Prediagnosis smoking and alcohol worsened prognosis independent of each other and clinical predictors. The effects of both risky behaviors were limited to viral hepatitis-related HCC and more profound among those with early-stage HCC. Risk for HCC-specific mortality increased with increasing pack-years smoked and ethanol intake (all p < 0.001 for trend), with an additive effect shown for the two habits [hazard ratio (HR) for alcohol ≥46.2 g/day and ≥10 pack-years = 1.72, 95% confidence interval (CI) = 1.45–2.05]. For either habit, cessation reduced HCC-specific mortality, but a significant mortality benefit occurred 10 years after abstinence (quitting smoking ≥10 years vs. continuing smokers: HR = 0.77, 95% CI = 0.61–0.97; quitting drinking ≥10 years vs. continuing drinkers: HR = 0.74, 95% CI = 0.56–0.98). In conclusion, among patients with viral hepatitis-related HCC, prediagnosis smoking and alcohol have a deleterious effect on HCC survival. Quitting smoking or drinking alcohol could reduce the excess risk, but only after a long interval of cessation.