The two sides had been at odds since Aug. 2, when talks broke down over CBS's demand that the so-called "retransmission fees" be increased in order for Time Warner to continue carrying its signal. Time Warner wanted to also receive CBS programming for its digital outlets without paying additional costs.
Under the agreement, programming on all networks resumed at 6 p.m. EDT (2200 GMT) on Monday, the two sides said in a joint statement. The agreement covers CBS's Showtime premium cable channel as well.
Financial terms of the deal were not disclosed.
Talks intensified in late August, according to a person with knowledge of the negotiations, after CBS Corp began airing ads in the three markets that urged fans to switch television providers.
(Read more: CBS win squeezes Time Warner Cable's margins)
The ads, which feature a much-anticipated matchup between star sibling NFL quarterbacks Peyton and Eli Manning, were designed to highlight what Time Warner subscribers would miss should the blackout in those major markets extend into the rabidly followed football season.
Analysts had predicted the blackout—affecting more than 3 million homes—would end around the NFL regular-season kickoff on Sept. 8, as both sides fear a backlash from irate football fans blocked from watching the hugely popular sport.
"They both realize that this was the big skirmish ahead of them, when TV viewers started paying attention after the doldrums of the summer," said sports TV consultant Ed Desser, a former top National Basketball Association executive, said when the ads first appeared.
The CBS ad included shots of the Manning brothers, who will face each other in a Sept. 15 game between the Denver Broncos and New York Giants.
CBS Chief Executive Leslie Moonves said in a statement: "We are receiving fair compensation for CBS content and we also have the ability to monetize our content going forward on all the new, developing platforms that are right now transforming the way people watch television.
"We wanted to hold down costs and retain our ability to deliver a great video experience to our customers," Time Warner Cable Chairman and Chief Executive Glenn Britt said in a separate statement. "While we certainly didn't get everything we wanted, ultimately we ended up in a much better place than when we started."