Having resumed on 54, with his team 251-6, the 23-year-old played patiently before reaching his ton from 260 balls and eventually ending on 118 not out.
Andy Hodd (44) had fallen early on day two, before much of the morning and afternoon were lost to rain.
But Jack Brooks' career-best 94 not out helped Yorkshire to 421-7 at the close.
The 32-year-old, with only three previous first-class half-centuries to his name, put on an unbroken 165 with Leaning as the pair seemingly batted a Lancashire attack minus the injured Jimmy Anderson out of the game.
After reaching 50 off 100 deliveries, Brooks' next 44 runs came off just 35 - including a seven-ball blitz for 26 runs that included two sixes and three fours.
The eighth-wicket partnership between Leaning and Brooks was also a Roses Match record for either side and gives Yorkshire some hope of forcing a positive result on days three and four.
Tom Bailey (3-107) took the only wicket to fall on the second day, bowling Hodd after the wicketkeeper had added only three to his overnight score.
Anderson, who will be sent for a scan on his right groin on Monday, will not bowl again in this match, but may bat if needed.
Lancashire's Ryan McLaren told BBC Radio Manchester:
"Tough, frustrating. The pitch has slowed up as the game has gone. Having taken that wicket this morning, you would have thought we would have been able to bowl them out pretty quickly.
"But Jack Brooks has batted well and Jack Leaning led the way and anchored the innings. We have created chances, but we didn't manage to take them. It was just a frustrating day.
"Sitting without a seam bowler (Anderson) is part of the game. That happens. But you've just got to adapt and find a way of taking wickets.
"It hasn't been easy, but we've got to try and pitch up, start again and hopefully knock them over quickly and try and bat long."
Yorkshire's Jack Leaning told BBC Radio Leeds:
"It's a big weight off my shoulders to get that hundred after a poor season in red-ball cricket. To do that in a tough situation in a Roses game against Lancashire means a lot.
"I didn't quite feel fluent for much of my innings, but to be able to get back to old ways and graft out ugly runs when I'm not feeling at my best is really pleasing.
"They bowled very well. They held their lengths and set the fields accordingly, which made it tough to score.
"Thankfully to get through that and get the team in a good position is massive. Then, Brooksy coming in and playing like he did was unbelievable."
Jack Leaning struck an unbeaten century as Yorkshire piled on the runs against Roses rivals Lancashire on a rain-affected second day at Old Trafford.