McCloskey said: "I grew up here in Ulster and it was always a dream to pull on the jersey. Despite some strong interest from other clubs, it was a fairly straightforward decision since all of my family and friends are here.
"The supporters, the facilities that we have and the quality of the coaching were all factors in my decision.
"We are developing strength in depth across the board and that will make us even more competitive next year. It's good for me to have some really strong competition for places in midfield because we push each other to improve.
"We had a disappointing finish to the season but I believe things are promising for the future and I'm excited to be part of that."
McCloskey made 18 Guinness PRO12 appearances this term, scoring three tries, helping Ulster reach the semi-finals.
And director of rugby Les Kiss believes his Ireland international has a big future at the Kingspan Stadium.
Kiss said: "This is fantastic news for the club as Stuart has been one of our standout performers all season.
"A major strength of Stuart's is his gain-line busting runs, which we have used to great effect this season. In addition to his powerful carrying ability, his deft handling and decoy lines have also caused havoc for defences.
"Stuart's appetite to work with the coaches here to accelerate his development has resulted in a well-deserved first cap for Ireland.
"He is a major asset to Ulster and will continue to be so for years to come."
To buy tickets for the Guinness PRO12 Grand Final click here. Also follow us on Facebook, join the conversation on Twitter, sign up to our YouTube channel for extensive match highlights and sign up for our newsletter for regular updates on the Guinness PRO12.