Having a fixed bankroll to spend definitely helps. You can also set a time limit for each gambling session. Whichever comes first.
Set the money you want to spend on that day, set your limit and your goals and dont ever chase your money back if you loose it. When you dont have proper preparation its really hard to stop yourself so you will loose money because of this, better to commit on your specific target to prevent this kind of problem.