The 20-year-old back-rower – who has been at the Provident Stadium since he was 14 – has been out injured since June with a knee injury.
The Academy graduate is hoping to return to action next month in the Super 8s, but he will do so with the security of a new deal which keeps him at Odsal until the end of 2017.
He has made 22 first-team appearances since debuting in 2013, but missed the Bulls’ last five games after injuring his knee during the thrashing of Doncaster at the beginning of June.
“When you are on a one-year deal, staying around is obviously in the back of your mind,” said Mellor. “So when James (Lowes) and Steve (Ferres) approached me about a new deal, I was over the moon.
“I have had some game time this season but I do not let things get to my head. I do not like to take things for granted, so I have got my head down, kept working hard and hopefully I deserve the new deal.
“The club has put a lot of trust in me by giving me a new deal now and I am determined to reward them with good performances when I am back.
“I love the club and I am really happy to be staying for another two years. Hopefully it will be even longer.
“I grew up watching the great Bradford teams and everyone at the club is working so hard to get those times back.”
St Helens snatched a last-gasp victory to go top of the First Utility Super League.
The reigning champions scored a dramatic Jordan Turner try two minutes from the end to secure a 20-14 derby win over Warrington.
Earlier, James Roby and Mose Masoe had earlier crossed for Saints tries, Wolves replying via Ben Currie and Kevin Penny.
Leeds can return to the top of Super League tonight with victory over Salford.