Take lots of short breaks doing the exact opposite. Get outside, do something physical, etc. I work from home so this is easier. Stay away from the computer/phone on weekends and evenings. Also coding in a field that you are passionate about or working with people you care about is helpful. A body can only take so much sitting motionless and a brain can take only so much focus before they say, “no more”. You have to create the balance that prevents it.
Chris