here's what helps me work for long periods of time (read: 9h+ when finals leave me no other choice):
1. BREAKS
you have to take breaks relatively often, so your brain doesn't get overheated :) either time them (modify the pomodoro method to your liking) or just take one every time you get stuck on a paragraph/read the same thing for the 4th time without it clicking/... basically, make sure you're giving your head space to cool down, so your brain cells don't get fatigued:)
2. FUEL
make sure you're eating enough (bonus points if the food is healthy and balanced - don't eat anything too sugary to prevent blood sugar spikes (those cause tiredness!)) and hydrating! have a glass of water on your desk at all times, refill it during your breaks. drinking enough water promotes optimal focus
3. PLAN
another v basic tip, but i swear by it. figure out what you have to do, then envision how you're gonna get it done and then Just Do It. knowing what you have to do makes staying focused easier, bc you just have to follow a list of tasks that you know will bring you to your goal. make a list and tick things off as you go, it'll motivate you as well as tell your brain exactly where in the process you are, limiting opportunities for distraction while you're trying to figure out your next move.
4. REST
similar to the break tip, if you get just too tired or keep getting distracted, take a Horizontal Break™: take a nap, lie down and scroll on your phone, whatever you want, bUT for a limited time. i usually set an alarm for 15min and then allow myself to snooze once (for 5min). if you don't trust yourself not to make it a 2h break, tell sb you're planning on getting back to work at a certain time, that way they can hold you accountable!
5. EXTRA MOTIVATION
if you're like me, a master procrastinator, you usually get a surge of motivation from the tragically close deadline anyway. but since you're gonna be spending a while sitting at your desk doing work, make it more enjoyable for yourself. put on some great study music, whatever motivates u. light your fave candle. turn on a salt lamp. study with friends (! ones that'll actually study with you and keep you accountable. i love silent study rooms on discord for this (or you can face time your best friend. again, only if you can keep from procrastinating together). give yourself sth to look forward to - i like to schedule lunch dates after my exams, a fun thing to follow the suffering of finals.
6. LIMIT DISTRACTIONS
an obvious one that i won't get too much into bc, well, kinda obvious. you know what distracts you, get rid of it as much as you can. for social media etc. i highly recommend cold turkey. you can restart your computer and it still won't let you access the sites you've blacklisted for an x amount of time :)
7. COMFORT
idk about you, but i'm not gonna get anything done if i'm not comfortable. personally, i like to study in sweats, comfy hoodies, i keep a blanket in my desk drawers, i take my make up off before my study sessions, so i can rub at my tired eyes in peace lol
another one where you know best, but really, try to minimize your suffering as much as possible :)
lastly, let me just say that the same as you do with sports, you need to build your study stamina. if you've never been able to stay focused for hours on end, you can't change that in just a day or two. but you can build from there by showing up and doing the work each day - i promise you'll notice a difference with time. good luck with your studies! x