A search is performed for dark matter particles produced in association with a top quark pair in protonproton collisions at √s=13 TeV. The data correspond to an integrated luminosity of 35.9 fb¯¹ recorded by the CMS detector at the LHC. No significant excess over the standard model expectation is observed. The results are interpreted using simplified models of dark matter production via spin-0 mediators that couple to dark matter particles and to standard model quarks, providing constraints on the coupling strength between the mediator and the quarks. These are the most stringent collider limits to date for scalar mediators, and the most stringent for pseudoscalar mediators at low masses.