Breaking a gaming habit usually works better through substitution than sheer willpower.
Practical steps that help: sleep more, pick up a job if you are old enough, put more effort into school, and physically increase the distance between you and the console or PC. Selling the hardware outright is the extreme version, and some people find it genuinely effective.
If the compulsion feels impossible to control, talking to someone you trust or a professional is a reasonable next step rather than a last resort.