The 33-year-old has agreed a two-year deal at Sixfields and will join the Cobblers on July 1 when his contract at Rovers expires.
Lines becomes the third new signing made by Northampton already ahead of next season and manager Keith Curle thinks his know-how will prove valuable.
"I think his attributes will really help us. He has a lot of experience and he also has a lot of quality on the ball and can help to unlock defences. He is a very cultured player," Curle told the club's official website.
"He is a midfielder who can create chances and set things up. He also has a quality set-play delivery.
"With a number of young players in the squad, we will need our share of experience for those players to look up to and Chris is ideal to fit that bill. He has won promotion four times in his career, he knows what is required and he is hungry for more success.
"Chris has a first-class work ethic and attitude, I think he will prove an excellent addition and he very much fits in with the culture we will have within the squad next season."