Sobotka played his first NHL game during the 2007–08 season on 24 November 2007, against the New York Islanders. His first career NHL goal was scored later that season, on 13 February 2008, against Ty Conklin of the Pittsburgh Penguins. On 26 June 2010, the Boston Bruins traded Sobotka to the St. Louis Blues in exchange for the rights to prospect David Warsofsky. On 6 November 2010, Sobotka recorded his first goal for the Blues against his former club, the Boston Bruins, beating Tuukka Rask after a turnover in the Bruins' zone. At the end of the 2010–11 season, he finished with 29 points in 65 games. On 15 June 2011, Sobotka signed a three-year contract extension with the Blues. On 9 March 2013, Sobotka scored his first career NHL hat-trick against the San Jose Sharks. Sobotka, at the completion of the 2013–14 season, became a restricted free agent, and instead of re-signing with the Blues, opted instead to sign with Avangard Omsk in the KHL on a three-year contract. When it became clear to the Blues that there was a possibility that Sobotka would be playing in the KHL, the organization filed for salary arbitration with the NHL. On 21 July 2014, Sobotka received a one-year, $2.725 million award from an arbitrator. The result of the arbitration award states that should Sobotka return to the NHL in the future, the Blues would retain his rights for one year at the amount awarded by the arbitrator; at the end of that year, he would then become an unrestricted free agent in the NHL. After completing three full seasons in the KHL, it was announced on April 6, 2017, that Sobotka would be returning to the Blues in time for the end of the 2016–17 season and then the playoffs. He finished the 2016–17 season on the salary awarded to him in arbitration in 2014, and agreed to a three-year extension with the Blues, set to kick in for the 2017–18 NHL season. On July 1, 2018, Sobotka, along with Tage Thompson, Patrik Berglund, a first-round pick in the 2019 NHL Entry Draft and a second round pick in the 2021 NHL Entry draft, was traded to the Buffalo Sabres in exchange for Ryan O'Reilly.
International play
On 6 January 2014, Sobotka was named to the Czech Republic's roster for the 2014 Winter Olympics in Sochi, though a leg injury sustained with St. Louis on 31 January prevented him from participating.