I would recommend batching screen time, which can also include some movement and exercise breaks between online school and additional educational/recreational screen time. For example, if your child has a one-hour lunch break, encourage them to spend 15 minutes doing some stretching or playing around outside , then allow 30 minutes of leisure screen time followed by another short exercise break before getting back to online classes.
You could also try incentivizing focus and productivity - come up with a points system where they can earn rewards for improved grades and concentrated effort. Make sure you also offer some physical incentives like small toys, games or treats . And involve your child in the reward selection process so they feel some agency.
You might also want to consult the teacher on how they'd recommend handling it, as well as any strategies for keeping kids focused during online learning. They may have some insights into what works best for your son and can help you identify triggers for his distractions. If the teacher isn't suggesting anything different, don't be afraid to gently push them to adapt their approach - many teachers are doing their best but might appreciate parental input on effective strategies they haven't thought of.
Good luck!