Ali century anchors cautious Pakistan to 376