"I am highly delighted to have secured Bayo's signature," said Northampton manager Gary Johnson.
"This shows other potential targets, the supporters, and the wider public just how ambitious we are to take this club forward."
The former Swansea and Torquay man first joined Northampton in January 2008, netting 39 goals in 95 appearances for Town.
His move to Gillingham yielded 11 goals in 46 games, but Gills boss Andy Hessenthaler told BBC Radio Kent on Tuesday that Akinfenwa was unlikely to sign a new deal with the Kent club.
I am sure this will capture the imagination of the supporters
Gary Johnson
"He's had a good year with us, we've made him an offer and he's looking like he's going to go somewhere else," said Hessenthaler.
"He'll go with our best wishes, he did great for us last year."
Akinfenwa becomes Northampton's second signing of the summer, following Byron Webster's move from Doncaster.
Johnson added: "He is a player who I know was very highly regarded by the fans when he was here before and he has convinced me he has the determination to be even more successful here this time around.
"I would like to thank the chairman for making this signing happen. Bayo is a great signing for our club and credit to David Cardoza for allowing this to become a reality.
"I am sure this will capture the imagination of the supporters and he is another piece of the jigsaw in place."
Source: BBC Sport
Source: BBC Sport