As
@mrzz pointed out, we have to racalibrate our predictions of the Bigger Three every month or two, but at this point I see no reason why Roger can't play at a respectable level until he's 40. That's August of 2021.
I think the general view, which I agree with, is that Roger will play as long as he feels that he has a decent shot at winning a Slam, namely Wimbledon. Even when it becomes clear that the ship has sailed, he could play a partial season farewell tour.
He has a decent shot at Wimbledon, and even the US Open, this year, when he turns 38. Let's assume the same for next year, when he turns 39, but it may be be more clear that he just can't keep up anymore. Then in 2021, he can do his farewell tour, play key tournaments, and retire at Basel.
So Basel, 2021, will be his last tournament. That's my (current) prediction. That would mean we've got Roger for a bit under three years, and at most 11 Slams (if he played every one from here on out, which would be unlikely).
Imagine the pressure that players will feel to "let the old guy win" at Basel that year.