CVS shares were up 6.6% at $57.65, while the broader market was down about 0.5%.

The company, which last year bought health insurer Aetna for $69 billion, raised its full-year adjusted earnings forecast to $6.89 to $7.00 per share, up from $6.75 to $6.90.

Pharmacy benefit manager (PBM) revenue rose 4.2% to $34.84 billion in the quarter, exceeding Wall Street estimates of $34.2 billion compiled by Evercore ISI. But the company said high dispensing rates of cheap generic drugs limited growth.

CVS also said it expects increased competition for its PBM business in 2020.

Revenue of $21.45 billion from its retail drugstore chains, which compete with Walgreens Boots Alliance Inc, was up 3.7% and also edged past analysts' estimates. But CVS said it is seeing less profit per prescription filled.

Walgreens on Tuesday said it planned to close about 200 U.S. stores, months after saying it would do the same in Britain.

CVS is working to bring more health services into its pharmacies and hopes to drive Aetna clients to take advantage of cheaper care for chronic conditions at its in-store clinics - one of the primary advantages of the acquisition.

The company said it was already seeing increased customer traffic and sales at walk-in clinics and retail stores where it has opened "HealthHub" pilot pharmacies that provide chronic care management for diabetes and other common health problems.

CVS said it plans to expand the pilot project to 50 stores in four metropolitan areas by the end of 2019 and to 1,500 stores by the end of 2021.

Chief Executive Larry Merlo said in a phone interview that the company was repurposing capital originally earmarked for opening new stores or remodeling existing ones for the HealthHub project.

"It's not new capital for us. It's capital that we would have spent on our real estate program, so there's no incremental spend," he said.

Evercore ISI analyst Ross Muken said the company's approach to the HealthHubs makes good strategic sense.

"In general the message was 'we are making progress despite the headwinds swirling around,'" Muken said

Those headwinds include intensifying political pressure to lower the cost of U.S. healthcare amid legislative proposals that take aim at insurers and PBMs.

The Aetna business reported revenue of $17.4 billion.

Excluding items, CVS earned $1.89 per share, topping analysts' estimates by 20 cents, according to IBES data from Refinitiv.

(Reporting by Manas Mishra and Tamara Mathias in Bengaluru; Michael Erman in New York; Editing by Maju Samuel and Bill Berkrot)

By Manas Mishra and Tamara Mathias