Third baseman Justin Turner and Boston have agreed to a contract worth just shy of $22 million that includes an opt-out after the first season, sources said.