If Larry Page stopped being Google’s CEO today, Sundar Pichai would undoubtedly be his replacement.

When Mr. Page tried in vain to convince WhatsApp CEO Jan Koum not to sell the messaging startup to Facebook for $19 billion two months ago, it was Mr. Pichai who accompanied Mr. Page to the high-stakes talks rather than Vic Gundotra, who was in charge of Google’s social products and would have seemed a more fitting choice.

Last fall, when Mr. Page wanted to buy home-automation hardware startup Nest for billions of dollars, he dispatched Mr. Pichai to convince Nest CEO Tony Fadell that he could succeed inside of Google and handle the demanding, sometimes-gruff Mr. Page.

The rise of Mr. Pichai, who is expected to appear on stage at Google’s annual developer conference beginning Wednesday, seemed unlikely just a few years ago, when he was surrounded by more-powerful colleagues and considered leaving for a senior role at Twitter.