Walgreens is increasing the age to buy tobacco at its drugstores to 21 later this year as the retailer faces possible sanctions from the Food and Drug Administration for allegedly selling to minors.

The FDA put Walgreens "on notice" in February, accusing the pharmacy chain of violating rules that prohibit selling cigarettes and other tobacco products to underage buyers. Walgreens, the FDA noted, is currently the top violator among pharmacies that sell tobacco products. Some 22 percent of Walgreens locations inspected by the agency caught employees illegally selling tobacco products to minors, the FDA said.

Walgreens has tightened its policies in response. Starting Sept. 1, it will require customers to be at least 21 years old in order to buy tobacco products.

For more on investing in health-care innovation, click here to join CNBC at our Healthy Returns Summit in New York City on May 21.

"We've seen positive results from other recent efforts to strengthen our policies related to tobacco sales, and believe this next step can be even more impactful to reduce its use among teens and young adults," Richard Ashworth, Walgreens president of operations, said in a statement.

A dozen states have already raised the minimum buying age and a handful of others are exploring similar action. Senate Majority Leader Mitch McConnell last week said he would introduce federal legislation sometime next month, marking the strongest support yet in Congress for what's been dubbed "T21."

CVS Health stopped selling tobacco products in 2014. Walgreens has tested a few tobacco-free stores but has stuck behind giving consumers the option to buy cigarettes, e-cigarettes and other products if they choose.