John Bercow, pictured at Wimbledon today, has decided to give his troubled marriage another go

John Bercow has decided to give his marriage 'one last chance' after his wife Sally's astonishing affair with his cousin.

Friends of the Commons Speaker have revealed for the first time how he dealt with the shock of discovering in May that Sally had had a relationship with lawyer Alan Bercow.

The affair – revealed by The Mail on Sunday – progressed so far that Alan, 57, even moved into the Bercows' £1.2 million flat in Battersea, South London, while the Speaker was away campaigning in his Buckingham constituency.

After Alan ended the relationship and returned to his wife, just before the affair came to light, John's friends say that the 13-year union 'teetered on the edge of divorce' for weeks as the Bercows embarked on a trial separation.

Sally was left alone in the flat while the Speaker stayed in his grace-and-favour Commons apartment. The couple's three children were forced to shuttle between their estranged parents.

However, after Sally complained that she found living by herself 'excruciatingly lonely', Mr Bercow decided last month to give her a final chance – on the understanding that she never strays again.

Under their new arrangement, Mr Bercow spends from Sunday evening until Thursday morning at the Commons flat with their children, while Sally remains in Battersea.

But on Thursday evening, the Speaker and the children move into the Battersea flat so that they can all spend a long weekend together as a family.

Scroll down for video

Mr Bercow's friends admit they are 'gobsmacked' by the reconciliation, with one saying: 'He is a supremely rational character, and knows it is far better for children if their parents are together.

'And he has a phenomenal ability to compartmentalise his thoughts, so when he is at work he doesn't allow his mind to stray to Sally and the pain she has caused him. That said, if she does it again the marriage is definitely toast.'

The first public sign that Sally and John's marriage might be back on track came a fortnight ago when she was spotted enjoying a drink on the Commons terrace with a female friend: Sally had previously said that one of the reasons the marriage wobbled was that she disliked being in Parliament, which was 'like living in a goldfish bowl'.

The affair between lawyer Alan Bercow and Sally progressed so far he even moved into the Bercows' £1.2m flat in Battersea, south London

She said: 'I hate Parliament, I always have done.

'It's a time warp, it's full of flunkies… all these portraits of f****** politicians from the 18th Century.

'John and I have had a difficult marriage for a long time, primarily because we're living in Parliament and I hate it there.'

The affair has also led to what one source described as a 'nuclear estrangement' between the two sides of the Bercow clan.

John's friends say that the 13-year union 'teetered on the edge of divorce' for weeks as the Bercows embarked on a trial separation

Ironically, the affair ignited after the Speaker tried to patch up a bizarre 50-year feud that started when his father, Charlie, and his uncle Samson – Alan Bercow's father – fell out over the ownership of the family minicab company in Finchley, North London.

Sally met Alan at the family rapprochement three years ago, their attraction sparking over a 'mutual appreciation of fine wine'. Now the split between John and Alan's side of the family is described as 'irrevocable'.

Sally has admitted she felt 'f****** heartbroken' when Alan returned to the £3 million West London home he shares with wife Erica.