Background: A meta-analysis was conducted to summarize the evidence from prospective cohort and case-control studies regarding the association between coffee intake and biliary tract cancer (BTC) and liver cancer risk. Methods: Eligible studies were identified by searches of PubMed and EMBASE databases from the earliest available online indexing year to March 2017. The dose–response relationship was assessed by a restricted cubic spline model and multivariate random-effect meta-regression. A stratified and subgroup analysis by smoking status and hepatitis was performed to identify potential confounding factors. Results: We identified five studies on BTC risk and 13 on liver cancer risk eligible for meta-analysis. A linear dose–response meta-analysis did not show a significant association between coffee consumption and BTC risk. However, there was evidence of inverse correlation between coffee consumption and liver cancer risk. The association was consistent throughout the various potential confounding factors explored including smoking status, hepatitis, etc. Increasing coffee consumption by one cup per day was associated with a 15% reduction in liver cancer risk (RR 0.85; 95% CI 0.82 to 0.88). Conclusions: The findings suggest that increased coffee consumption is associated with decreased risk of liver cancer, but not BTC.