Sri Lanka beat Pakistan, preserve number one ranking