Two-finger scrolling stops working after a while
A simpler solution that seemed to work for me in Firefox:

open about:config

and then find the properties

browser.gesture.swipe.left
browser.gesture.swipe.right


and set them from Browser:BackOrBackDuplicate and Browser:ForwardOrForwardDuplicate to empty. It's a workaround for a known bug ( https://bugzilla.mozilla.org/show_bug.cgi?id=927702 ).