This is something that not only happens with gambling but it is very common at other activities, an example of this are video games, in which a person may want to play for some more minutes, minutes which then morph into hours.
Isn't this what addiction is all about! Not being able to control yourself.
You spend time and other resources on a n activity although you don't profit much from it and it's probably causing more damage than good.
Personally, I believe only professional assistance can help addicted people. Most of the advices I've read on this thread like setting a budget and the like, unfortunately, usually don't work.