Messi, 32, has spent his career with Barca but has a clause allowing him to leave for free this summer.
Guardiola coached Messi at the Nou Camp between 2008 and 2012, winning three La Ligas and two Champions Leagues.
“He will stay there [at Barca], that’s my wish,” said the City boss.
Guardiola left Barca for Bayern Munich having become their most successful manager, with 14 trophies in four seasons.
He went on to win three successive league titles in Germany and has won the Premier League for the last two seasons with City, although this term they trail Liverpool by 22 points with only 13 games remaining.
Messi, who has won the Ballon d’Or player award six times, 10 league titles and four Champions Leagues, is under contract until 2021.
But he spoke out this week against Barcelona sporting director Eric Abidal after the Frenchman accused players of not working hard under former coach Ernesto Valverde.
Barca are three points behind leaders Real Madrid in La Liga but Guardiola would not be drawn on the apparent unrest between Messi and Abidal – both former players of his – adding: “I’m not going to talk about players for other clubs.
“I think he will finish his career there.”