Pujara, playing his first test since the Boxing Day match against Australia in December, remained unbeaten on 135 and guided India to 292 for eight wickets before rain brought an early close to the day’s play.
Ishant Sharma (two) was not out at the other end.
Resuming on 50-2, the visitors lost captain Virat Kohli (18) early but Pujara and Rohit Sharma (26) added 55 for the fourth wicket to prop up the Indian innings in the deciding match of the series, tied at 1-1.
Rohit, who has recently been preferred to Pujara in the test team, fell in the last over before the lunch break, edging Prasad to Upul Tharanga at first slip.
After a rain-hit opening day when just 15 overs of play was possible, Sri Lanka came back strongly in the morning session with Prasad troubling the batsmen on numerous occasions.
India’s scoring opportunities soon dried up and captain Angelo Mathews benefited from the build-up of pressure when Kohli edged behind to give debutant wicketkeeper Kusal Perera, who had dropped the batsman on Friday, his first test catch.
Pujara and Kohli added 50 for their third-wicket stand.
Pujara, forced to bat at the top due to injuries to regular openers, looked solid in defence but failed to rotate the strike and only found his scoring touch when Mathews introduced off-spinner Tharindu Kaushal into the attack.
The right-handed batsman hit Kaushal for three successive boundaries and the runs started flowing for him after that. The 27-year-old reached triple figures with a tight single off spinner Rangana Herath.
After finding Rohit’s edge with the last ball before lunch, Prasad picked up all-rounder Stuart Binny with the first delivery of the second session to be on a hat-trick, which was staved off by Pujara.
Debutant wicketkeeper Naman Ojha (21) then added 54 with Pujara for the sixth wicket before playing a rash shot against Kaushal to hole out at long on.
Ravichandran Ashwin became Prasad’s fourth victim, reducing India to 180-7 but Pujara continued to thwart the hosts, adding 104 in an eighth wicket stand with Amit Mishra (59).
Legspinner Mishra looked completely at ease against both the seamers and the spinners and notched up his third test fifty to demoralise the Sri Lankan bowlers.
Mishra was finally out stumped to Herath when he danced down the wicket but only managed an inside edge onto his pads with the ball trickling to the wicketkeeper.
(Writing by Sudipto Ganguly in Mumbai; Editing by John O’Brien and Julian Linden)