[9] On 26 May 2014, as a restricted free agent, Nilsson decided to sign a contract with Russian club Ak Bars Kazan of the Kontinental Hockey League.
[12] On 6 July 2015, Nilsson's NHL rights were traded for a second time, from the Blackhawks to the Edmonton Oilers in exchange for prospect Liam Coughlin.
[12] Nilsson earned a spot on the Oilers roster after a stellar training camp, not allowing a single goal in the preseason.
In the 2015–16 season, Nilsson appeared in a career high 26 games with the Oilers, sharing the pipes with Cam Talbot, before he was traded approaching the trade deadline by the Oilers to the St. Louis Blues in exchange for Niklas Lundström and the Blues' fifth-round selection in the 2016 NHL Entry Draft on 27 February 2016.
[13] On 2 July 2016, Nilsson as a restricted free agent was traded from the Blues to the Buffalo Sabres in exchange for a 2017 fifth round draft pick.
[14] During the 2016–17 season, in December 2016, Nilsson began wearing a mask with a gay pride flag painted on the back as a sign that ice hockey welcomes diversity.
He drew praise from Wade Davis, executive director of the You Can Play campaign, who said that Nilsson "is taking a risk on multiple fronts and is standing up for something that he believes in, knowing the backlash that could come his way.
"[15] After a successful tenure with the Sabres, serving as backup to Robin Lehner, Nilsson left as a free agent in signing a two-year, $5 million contract with the Vancouver Canucks on 1 July 2017.
[17] During the 2018–19 season, on 2 January 2019, he was traded by the Canucks along with Darren Archibald to the Ottawa Senators in exchange for Mike McKenna, Tom Pyatt and a sixth-round draft pick in 2019.
[21] However, Nilsson ultimately never played a game for Tampa Bay, and, after missing the entire 2020–21 season with post-concussion symptoms and neck problems, announced his retirement on 8 August 2021.