Skipper Craig Ervine (91) and Sikandar Raza (56) driven Zimbabwe to 302 for 8 immediately after electing to bat to start with in Kandy.
The bowlers then held Sri Lanka to 280-9 regardless of a 118-operate fifth-wicket stand among Shanaka, who hit his very first ODI century, and Kamindu Mendis, who made 57.
The selecting match is on Friday at the very same venue.