After bowling Sri Lanka out for a modest 197 on day one at the Sheikh Zayed Stadium, Pakistan went to lunch on day two at 115-0, just 82 runs adrift with all its wickets intact.
The right-handed Hafeez was the more confident batsman, stroking eight fours and a six in an undefeated 73 off 121 balls.
Taufeeq endured a few anxious moment as he compiled 35 not out off 107 deliveries. The left-hander's only boundary came via an inside edge to fine leg.
Sri Lanka used five bowlers but could not fashion a breakthrough.