The Los Angeles Dodgers and catcher Austin Barnes have agreed to a two-year contract extension, a source told The Athletic. Barnes was set to become a free agent this offseason.

Barnes, 32, has spent eight seasons with the Dodgers since making his major-league debut with the club in 2015. He serves as the backup catcher behind Will Smith and has also played second base when the Dodgers need flexibility on defense.

This season, Barnes got off to a hot start offensively at the beginning of the campaign and has since cooled down. He entered Sunday hitting .188 with four home runs and 12 RBIs.