It is also prohibited from identifying his spouse, known in court documents as YMA, or three other individuals involved in the tabloid “kiss-and-tell” story.
PJS, who has children with YMA, took legal action earlier this year when rumours of an extra-marital affair began to circulate.
He argued identification and exposure of the extra-marital activity would be a misuse of private information and a breach of confidence and sued NGN.
NGN won the first round of the privacy dispute in January when a High Court judge refused to impose an injunction, but the case went to the highest court in the land after appeal judges said the ban should be lifted.
In May, the Supreme Court ruled that The Sun on Sunday should be barred from revealing the identity of the man referred to only as PJS, claiming his children’s right to privacy outweighed the paper’s right to free speech.
It said that the information was private, there was no public interest in its disclosure and that, while secrecy and confidentiality may have been compromised by publicity, a court was unlikely to find that PJS’s right to privacy was defeated by that fact.
The Sun editor Tony Gallagher said “the law is an ass” in a tweet decrying how his paper could not name the couple.
At London’s High Court on Friday, Mr Justice Warby said that PJS and NGN had agreed a final order in the action for breach of confidence and misuse of private information.
The proceedings were “stayed” on the basis that NGN pay a “specified sum” in full and final settlement of PJS’s claim for damages and costs.
NGN also agreed to give undertakings not to use, disclose or publish certain information and to remove and not republish certain existing articles.
The undertakings extended to not publishing any information which identified or was liable to identify PJS as a party to the action, including identifying his partner or three other individuals.
The judge said: “I accept the undertakings offered by the defendant, which are clear and plainly given on advice.
“I see no reason not to make an order for payment of the agreed sum. There is no reason not to allow the parties to keep the figure confidential.”