Mitesh Patel, 37, told jurors he loved his wife Jessica, who was originally from Leeds, but he should have been honest and not married her, describing himself at one point as a "gay Asian man".
He said that since her murder at their home in The Avenue, Linthorpe, Middlesbrough, in May, he had often thought it ironic that they had both watched a YouTube video called "How long someone takes to die from strangulation", weeks before she died.
Teesside Crown Court has heard that the defendant had fallen in love with a doctor called Amit Patel, that his wife knew about the affair, and that the doctor had emigrated to Australia.
The Crown alleges the defendant wanted to join him in Sydney once he had collected a £2 million life insurance payout.
The jury has also been told he met men on the internet and the Grindr app for sex.
The married couple wanted to have children and underwent three cycles of IVF treatment, despite concerns she had about texts and gay porn she found on his phone in 2017, the court heard.
Nicholas Campbell QC, prosecuting, said the accused had remained in contact with Amit Patel and while Jessica was undergoing the final IVF cycle her husband was searching for properties in Sydney.
Mr Campbell said he had also made internet searches about Hindu funerals for a married woman, insulin overdoses and coroners.
Cross-examining the defendant, Mr Campbell said: "When you and Jessica had last spoken about IVF, she had told you, 'Mitesh, I'm no longer going along with having a child with you because you have not changed your ways and there's no way I will have a child with you'."
Patel replied: "That's not true."
Mr Campbell added: "From that time onwards, the plan you had already made up in your mind to kill her was brought forward."
Patel said: "I made no such plan and that's not true."
The court has heard the couple had three frozen embryos at a Darlington clinic that were ready to be implanted.
The jury has been told the defendant discussed with Amit Patel them bringing up a child conceived by his wife.
The defendant said his concern was that she could die young from breast cancer, like her mother, adding: "If Jess was ever to pass away, I didn't want my children to grow up without a parent."
The prosecution brought up a YouTube film which about strangulation which was watched several times, the Crown claims, by the defendant.
He said he was watching a documentary with his wife and the subject came up so they both watched the YouTube video.
He told the jury: "For the last six and a half months, every day in that prison cell, one of the many, many things I have thought is, 'how ironic was this'.
"The cause of Jessica's death was that, and anyone sat there would be thinking, 'What on earth is going on?'."
Earlier, he told the court he lost his virginity to Jessica in December 2008, after they got engaged, and his first gay sexual experience was with Amit Patel early in 2012.
Asked what he remembered, he replied: "That maybe I made a mistake (getting married) and maybe I was gay."
Asked if he had any regrets about the marriage, Patel replied: "I should have been more honest with myself and I should not have married her."
He said he was the "dominant one" in the marriage, explaining he was the driving force behind their pharmacy business and that he wanted them to retire by the time they were 40.
His wife had told his brother her concerns that her husband was having an affair with Amit Patel, the court heard.
The defendant said: "I cannot explain how I felt, it was the fear of being exposed as an Asian gay man, and I was going to let Jess down.
"I had married Jess and all her dreams were going to come to a crashing end."
Earlier, he told Toby Hedworth QC, defending, he accepted the jury had seen that he had told lies to people on social media.
Patel told the court: "One thing is the truth, I have not anything do to with killing Jessica."
Patel said he last spoke to Amit three days before Jessica was murdered.
He did not call him in the days after - prior to his arrest - the defendant said, as he needed to be with his family.
The Crown said Patel and Amit had previously discussed being together if Jessica died.
Mr Campbell suggested the real reason Patel did not make contact was that he did not want detectives investigating the murder to know about his relationship with Amit.
Patel said: "I didn't speak to him, not because I couldn't or shouldn't, I wasn't in the right frame of mind.
"I was terribly shocked."yo