The Dodgers and pitcher Walker Buehler on Wednesday agreed on a two-year, $8 million contract to avoid arbitration this month and next winter.