Havas has picked up Giffgaff, which is thought to spend close to £20m a year on media, from All Response Media in a closed process.
Telefónica already use Havas for O2, which is believed to spend upwards of £50m a year on media.
The Spanish telecom giant, which does not disclose its UK media spend, said combining the two accounts would improve "operational efficiencies" across traditional above-the-line advertising such as TV and out of home and performance marketing such as search advertising.
Telefónica stressed it wants O2 and Giffgaff to remain distinctive brands.
"While the newly formed team will seek synergies and efficiencies through the consolidated trading entity, it is critical that both brands have the flexibility within deal structures to meet their individual objectives and needs," Telefonica said in a statement.
"We will be looking for media partners to work with Team Telefónica UK to help us realise those ambitions and also build on existing relationships to further drive Telefonica media performance."
The company offered no guidance on the value of its UK media spend.
Telefónica launched Giffgaff in 2010 as a youthful, SIM-only brand and it has used All Response Media, in which Havas has a 57% stake, since the launch.
Giffgaff’s turnover has soared from £1.7m in 2010 to £351m in 2016, according to its most recent accounts at Companies House.
A spokesman for All Response Media said: "All Response Media have a great track record of launching start-up challenger brands, and Giffgaff epitomised this success, having launched them in 2010 and been their media agency ever since.
"We are therefore naturally disappointed that the success we have helped to create has ultimately led Giffgaff to follow a more traditional path, but we wish them well in the next phase of their growth."
Giffgaff raised its profile this year by sponsoring ITV’s The Voice in the face of growing competition from SIM-only rivals such as Voxi, which Vodafone launched last year, and Superdrug Mobile, which the beauty and pharmacy chain unveiled in partnership with mobile network Three this summer.
Havas Group Media is expected to take over planning and buying for Giffgaff from October.
The media agency group previously operated a subsidiary agency brand, Forward Media, to look after O2 but it became part of the main Havas media operation at the start of this year.