Wondering when you should upgrade your Nexus or Pixel? Google has updated its support page to reflect when it will no longer offer telephone and online support for the devices, and you can use that info to make a decision. In the past, the big G promised that its phones will get Android updates for at least two years and security updates for at least three years after they're released. Once it security updates stop, phone and online support stop, as well.
Based on the info Google listed on its support page, it's staying true to its word. The Pixel and the Pixel XL, which were released in 2016, will get the latest Android updates until October 2018. They'll get security updates until October 2019, the same month Google will stop providing customer service for them.
Mountain View will also stop supporting the Huawei-made Nexus 6P and the LG-made 5X in September 2018, a year after they stop getting new OS updates. If you still own a Nexus 6 or a 9, you'll only get security updates until October this year -- after that, you can't call or chat with Google anymore in case you encounter issues with your device.