The Big Bang Theory is ending after 12 seasons (therealjimparsons/instagram)

Jim Parsons has written a heartfelt open letter after it was announced that The Big Bang Theory will be ending with its twelfth season finale.

The star was reportedly the reason that negotiations with CBS for two more seasons fell through, as he declined a deal worth more than $50 million in order to leave the show.

Despite this, the star – who came out in 2012 and got married to his long-term partner Todd Spiewak last year – has posted an Instagram photo of the main cast surrounded by a heart.

By the picture, which was taken while the actors were shooting the first episode of season 11, he wrote: “❤️Swipe for my caption to this picture which was too long to just write here (not surprising given the circumstances) ❤️.”

In the emotive message, which comes to nearly 500 words, he has thanked fans, the writers, cast and crew.

Parsons said he had not yet come to terms with the show’s demise, writing: “It is hard (nearly impossible actually) to really accept that this is a picture of the first of the final 24 episodes we will shoot for The Big Bang Theory.

“I feel very fortunate that we have another 23 episodes to shoot this season because I am hopeful that with each and every one, my level of REALLY accepting this fact will sink in.”

Parsons, who has become the highest-paid gay actor in the world while starring in the record-breaking sitcom, added that he didn’t need to wait to feel gratitude towards its fans, as well as everyone else who has made it possible.

“I feel such intense gratitude for our devoted viewers who are the ACTUAL reason we have been graced with the opportunity to explore these characters for 12 years of our lives,” he wrote.

“I feel grateful to our crew – many, many of whom have been with us since day one – and who are the people who bring a sense of steadiness and dependability.”

He said the crew members were “so warm and kind and always quick to say hello and smile at us every time we come to the set,” adding that they “are in many ways the real and steady heartbeat that keeps this body of work alive and breathing while we, like flailing arms and legs, act like jackasses and fools in attempt to make someone laugh.”

Parsons continued: “I am grateful to all the writers of the show – those with us now and those that have come and gone – because, without them, there would literally be no Big Bang Theory at all, ever.

“The writers thought of this show, the writers created these characters, the writers are the ones who found ways to keep coming up with organic, entertaining ways to keep the life of this show going which is a task much, much more challenging than anyone other than them will ever know or understand.”

The 45-year-old actor, who spoke out in support of genderfluid people earlier this year ahead of the release of his film, A Kid Like Jake, saved his final note of thanks for his fellow cast members.

“While I know that they already know it,” he wrote, “it bears repeating again and again: I am so terribly grateful for the cast in this picture and the cast members who aren’t pictured here – whether they were in one scene or many episodes along the way.

Parsons added: “You are all my playmates that I have fallen in love with and who have become a part of my life on set and off.

“You are my playmates when we don’t feel like playing but have to because it’s our job to get out there and communicate and pretend we’re these other fictional people and we look into each other’s eyes and say these words and end up creating this weird, other reality that has enriched my life more than I will ever fully understand.

“I will miss all of you and all of this more than I can say and more than I can know at this time.”