But Erdogan's controversial ban on Twitter last week, as well as a vast corruption scandal that erupted late last year, has exposed a deep-seated rift between the two ahead of crucial local elections on March 30.
Turkey's 10 million Twitter users were banned Thursday from accessing the site after Erdogan vowed to "wipe out" the messaging service, which has been used by to publish damaging allegations against his government.
Western leaders and rights groups denounced the move as a violation of free speech. But more surprising, perhaps, was the swift condemnation from Gul -- a frequent user of social media -- who labelled the move "unacceptable".
"This is of course an unpleasant situation for such a developed country as Turkey, which has weight in the region and which is negotiating with the European Union," he told reporters Sunday.
"I believe this problem will be over soon."
Some commentators say the latest clash highlights the different styles of the two men, who co-founded the Islamic-rooted Justice and Development Party (AKP) in 2001 and have remained close allies since then.
Gul acted as Turkey's caretaker prime minister for four months before Erdogan -- then banned from politics because of a conviction for reciting an Islamic poem -- was able to take office after the AKP's election win in 2002.
Together they saw off a 2007 attempt by the army to prevent the AKP from securing the presidency and a bid by the judiciary to ban the party in 2008.
"The president takes advantage of the prime minister's wrath. Whenever Erdogan makes people angry, Gul adopts a conciliatory tone," said Serkan Demirtas of the Hurriyet Daily News.
"The Twitter case once again demonstrated the great differences in their style," he said.
Discord between the two first began to surface in June last year, when protests erupted across Turkey over what critics say is the creeping authoritarianism of Erdogan's regime.
Riot police reacted with a heavy hand, deploying tear gas and water cannons against the crowds. More than 8,000 people were injured and at least eight killed in the clashes. Erdogan labelled police tactics as "heroic", even as international condemnation poured in.
Gul, by contrast, took a more moderate tone, instead encouraging peaceful protests.
And in the graft scandal -- the biggest in Turkey's history -- he has taken a firmly opposite stance to Erdogan.
The crisis erupted in December when dozens of leading businessmen and political figures, including the sons of three ministers, were rounded up in police raids in Istanbul and Ankara.
In response, the firebrand prime minister waged war against the judiciary, calling the corruption probe an "attempted assassination" and a "judicial coup".
Erdogan has responded by sacking hundreds of police and prosecutors believed to be linked to US-exiled cleric Fethullah Gulen and pushed through unpopular laws, including curbs on the Internet and the judiciary.
'Good cop, bad cop'
Gul, if not openly critical of Erdogan before the Twitter ban, has repeatedly spoken out in support of judicial independence.
He is also seen as being closer to Gulen, whose movement wields considerable influence in the police and judiciary and is accused by the government of instigating the bribery probe.
Ersin Kalaycioglu, professor at Istanbul Policy Center, says that the two are just "playing good cop, bad cop like they always do".
"Gul is not that innocent. If he was really opposed to Erdogan, he would not have approved the Internet and the judiciary bills," he said.
But observers note that with local polls in March and presidential election in August, Gul could be going for the kill as both men jostle for the top job.
After three terms as prime minister, the maximum allowed under AKP rules, some think Erdogan may have set his sights on the presidency, particularly if it is given US-style executive powers.
Still, the graft scandal could well spell the end of Erdogan's political ambitions, leaving the soft-spoken Gul in power.
"Erdogan is likely to change the party laws and remain as the prime minister to keep fighting the corruption scandal," said Mehmet Akif Okur, a political scientist at the Ankara-based Gazi University.
"But the local polls will tell the tale. If his party emerges the winner, he can challenge Gul to become the president," he said.
Source: Middle East Online