Any deal for Morgan Rielly is likely going to be max term... 7-8 years.
As for how much money... I think you have to look at what Alex Pietrangelo and Torrey Krug got in a "worse" market (covid uncertainty versus league likely being back to normal, just working off the debt the players owe), while being older than Rielly.
Ultimately, on the open market I don't see how you can justify anything less than about $8.5m x 7. Would he take a discount to stay in Toronto? probably. If you "value" the 8th year at $5m, it brings his AAV down to just a shade over $8m. I'd imagine that he can be signed for somewhere around $7.5m x 8.
Do the Leafs do that? It's a tough call IMO... I suspect some of the decision will be based on the development of Sandin & Liljegren. It's hard to justify letting a 28 year old Morgan Rielly walk, to keep a 31 year old TJ Brodie or 33 year old Jake Muzzin.