The 'Castle on the Hill' hitmaker is set to play himself in Danny Boyle's Beatles-inspired comedy musical and the 55-year-old actor has revealed they got to know one another over a round of the tabletop game Carrom whilst on set.
Sanjeev - who will also play himself - told The Sun newspaper: ''I did a day's filming with Ed. He was great fun.
''There is a traditional Asian game called Carrom and he had never seen it. It's a board and you flick counters around on it.
''Me and Ed had a game and I let him win.''
'Yesterday' will star 'Mamma Mia! Here We Go Again' actress Lily James as teacher Ellie, whilst 'EastEnders' actor Himesh Patel is on board to play male lead Jack Malik.
'Saturday Night Live' comic Kate McKinnon has also been cast in the role of Deborah.
The iconic Liverpool band's surviving members, Sir Paul McCartney and Sir Ringo Starr, are also set to make appearances along with James Corden.
'Love Actually' writer and director Richard Curtis is penning the script.
The plot follows a struggling musician (Jack) who learns he's the only person on Earth who can remember The Beatles.
Ed, 28, is no stranger to guest roles, as he appeared as himself in 2015 comedy 'Bridget Jones's Baby' when Bridget attended Glastonbury festival.
The singer also made a cameo in his favourite TV show 'Game Of Thrones', with a fleeting appearance in the first episode of the hit HBO series' seventh season in July 2017.
But the 'Perfect' hitmaker faced a harsh backlash from fans for his role - which saw him play a Lannister soldier, who had a chance encounter with Maisie Williams' Arya Stark.
He said afterwards: ''No one wants to see me come back. I wanted to be a cameo in it, and I've done the cameo. I'm cool with it, though. I enjoyed it.''
Ed also played Sir Cormac in five episodes of the historical drama 'The B*****d Executioner' created by 'Sons Of Anarchy' showrunner Kurt Sutter.
Celine Dion barely cracks a smile and yet she's the greatest guest yet.
Phildel has gone back a step, in terms of her musical compositions, and returned to a style more reminiscent of her debut album with her latest...
To promote the release of her latest album 'Designer', Aldous Harding has undertaken an extensive European tour. On Wednesday night Harding played to...
As it's been 12 years since the last Bridget Jones movie, expectations aren't too high...
Bridget has always known how to get herself into a muddle - catastrophic muddles at...
After battling the dating scene and finally finding love with Mark Darcy, Bridget Jones is...
In July of 2015, Ed Sheeran played his biggest gigs to date, selling out Wembley...