In Tinker Tailor Soldier Spy (2011), Richard is Peter's friend. Richard left him and Peter started crying. This scene happened right after Smiley told Karla's story to Peter. Why did Richard leave Peter alone?
Peter is homosexual and Richard is his gay partner. Peter ends their relationship because of his job spying for Smiley. Evidently, this abrupt end to their relationship comes out of the blue. Richard, true to his own words, does in fact take it like a "grownup." As soon as he has gone, Peter grieves the forced end of their relationship.
Why does this happen?
Smiley's spy operation is getting increasingly dangerous, particularly for Peter, as the only member of Smiley's crew whose day job is at the Circus. His assignments are more egregiously illegal while the odds of detection are also increasing. Case in point: on his last mission Peter was almost discovered stealing sensitive information from the Circus, despite he and his accomplice having taken meticulous precautions and executing their tasks flawlessly. (I describe this in more detail in this other answer.)
The purpose of that mission was to obtain evidence that could prove whether newly-resurfaced British spy (and presumed traitor) Ricki Tarr is telling the truth. When Peter brings the evidence to Smiley and discovers Tarr is present, he explodes in a burst of violence that reveals how conflicted he is over betraying his own country for the seemingly unimportant purpose of discrediting the flimsy cover story of Tarr, who he believes is a genuine traitor: a turned spy whose betrayal is possibly implicated in the supposed death of Jim Prideaux and all his contacts.
Crucially, after the day's business with Tarr is concluded, Smiley invites Peter to have a drink with him. This is when he tells Peter his story about Karla. At the end of their evening, Smiley advises him that if there's anything in his life that won't stand up to scrutiny, now is the time to clean it up.
I don't know if Smiley knew that Peter was gay; it was timely advice in any case. Likely, there were clues; we even see some: when Peter is stealing from the Circus archives, a pretty blonde lady flirts with him, but he begs off with a transparent excuse: his plans this weekend? "Oh, you know... visiting aunts." Right. Presumably, this kind of thing has happened before, and Smiley (who has worked with Peter previously) has probably noticed.
Why is Peter's gay relationship something that must be "cleaned up?"
1970s Britain was not as tolerant of homosexuality as it is today. I'm afraid I can't be more specific than that, sexual attitudes of Cold War-era Britain not being my specialty, but it doesn't seem like a controversial statement. I suspect that being gay could have disqualified Peter from working in the intelligence service, or even the whole government.
So, setting aside his job as a double-agent working for Smiley, and his job as a spy working for Britain: as a gay man in that era, Peter is already living a double-life and working to keep one of those lives secret. If anything about that double-life causes someone at the Circus to innocently start poking around Peter's life, it could lead to the discovery of Smiley's operation.
Peter ends his gay relationship so that he only has one set of lies to manage: the lies Smiley requires him to tell.