I think different things work for other people. For example, I find that a good pair of closed-back over-ear headphones is all I need to stay focused. Those are the ones that will cover your whole ear and can block out a lot of outside noise. I pair that with some good instrumental tunes — usually jazz — and I’m ready to focus on whatever I’m doing for hours. It was a strategy I used daily when studying to get better GAMSAT results using this website.
Besides blocking out sound, I also did some of the obvious stuff. For example, I set my phone on silent mode and left it in the other room while studying. And I got a browser extension that let me block out distracting websites during my study sessions. The latter was very helpful because I would often absent-mindedly open meme websites when I should have been studying. Having those sites blocked for the duration of my study sessions made it much easier for me to focus.