It is thought that the Guardian believes the event has in recent times become too corporate and is not in keeping with its brand values.
As part of the new deal, TMG’s newspapers and its website, Telegraph.co.uk, will provide in-depth coverage of the festival.
Journalists on the titles will also take part in a number of debates at the event.
TMG will also be media partners of Brecon Jazzz, part of the Hay festival, and its international offshoots, which include Hay Festival Beirut, Lebanon and The Maldives Hay Festival.
Gaby Wood, head of books at TMG, said: "We’re delighted and honoured to be associated with Hay Festival, which has only gone from strength to international strength since Bill Clinton dubbed it 'The Woodstock of the mind'."
"Its aims are impeccably aligned with the aims of the Telegraph, where we are constantly looking for new ways to introduce writers and readers, and to provide a forum for the most vibrant ideas of our time."
Previous sponsors of the event include The Sunday Times (1989-1992) , The Independent (1993 and 1994) and The Guardian (2002-2010).