The Doonhamers announced that Johnston and assistant Sandy Clark have both put pen-to-paper on Friday afternoon.
“Magic” and Clark – who were at the helm when Queens won a league and cup double in 2013 – have both penned two-year contracts which takes them to end of the 2022/23 season.
Johnston, 47, has seen a remarkable turnaround in form since last December. Queens looked dead and buried at the foot of the Championship table with only four points on Boxing Day.
However, since then Queens have went on a superb run of form and are now challenging for the promotion play-offs.
A delighted Johnston said: “We still have three big games left of this season and they must be our focus for now as we want to try to get into the play-offs. We want to finish strongly so we can look forward and start planning for next year.
“Queens are a good club with big potential so I am happy to commit for another two years and hope to take the club as high as possible.”
Palmerston chairman, Billy Hewitson added: “Since returning to the club, particularly since the turn of the year, they have shown what they can do.
“So, we are happy they have signed the new deal and they can now continue to focus on the remainder of the season and see where that takes us.”
The news has been welcomed for Queens fans online.
@Dillonjahn tweeted: “Well deserved. I was a doubter when AJ returned to the club and really thought he should have been axed after Boxing Day but ut shows that having faith and giving time to someone can be rewarding. Hugh turnaround since New Year and I’m happy to have been proved wrong.”
Gary Boole added: “Happy with with, definitely wouldn’t have said that at the start of the season. Hopefully this can be a start of a brighter future for the club.”
Meanwhile, Queens right back Willie Gibson believes the team have nothing to lose going into their final three matches of the Championship season.
One victory would all-but secure the Dumfries men’s second tier survival but Gibson is looking up towards the promotion play-offs.
Queens realistically need to win all three of their remaining games and hope fourth place Inverness drop points in two of their fixtures to reach the play-offs.
Speaking after the Doonhamers’ 1-0 home defeat to Raith on Tuesday night, Gibson said: “With Dunfermline drawing with Dundee there’s still something to play for.
“If you gave us this scenario at Christmas time, we would’ve bit your hand off as we were bottom of the league and everyone had written us off. We have to just go for it now as we have nothing to lose, and we’ll see what happens.
“For large parts of the Raith match they couldn’t get out of their half but we couldn’t find the final touches.
“Normally we’re looking at the defence shipping an easy goal and the boys up front pulling us out of a hole but tonight I thought we defended well but it just wouldn’t drop for us in front of goal.
“Big Ayo Obileye spooned one over the bar which has to go in really. He apologised to the boys for missing after the match but he’s been outstanding all season.”
Queens boss Johnston mirrored Gibson’s views of Tuesday’s match at Palmerston and believes his side should’ve got at least a point for their efforts.
He said: “I don’t think we could’ve asked for much more especially in the second half. It was one-way traffic – they couldn’t get out of their own half. I thought the boys were excellent and it was one of the best performances from us this season.
“We were bombarding them and I thought it was only a matter of time before the goal came. We had half chances but it wouldn’t just drop for us, it was a frustrating night at the office.”
The manager hopes striker Stephen Dobbie can return in time for Saturday’s match against Dunfermline.
The ex-Blackpool forward picked up an ankle knock in training, but Johnston stated he hopes the injury settles down and he can be in contention for the weekend.