Attorney General Andrew Cuomo, who announced the agreement Tuesday, sued after investigators bought expired goods in 60 percent of CVS stores they canvassed across the state.
The settlement ends a lawsuit that the state filed after it said CVS breached a prior agreement to halt expired sales.
A CVS spokesman says the company is committed to keeping expired products off shelves and that the settlement doesn't include any admission of wrongdoing.
Cuomo reached a similar settlement with Rite Aid in 2008.
CVS is the retail division of Woonsocket, R.I.-based CVS Caremark Corp. It has about 432 New York stores.