for Gmail especially, my cookies need to be turned on. When I check Firefox's Options, it says they are already enabled. I found out that switching "Use Custom Settings for History" to "Remember History" next to 'Firefox will:' under the Privacy tab seems to fix the issue and make Gmail happy. But within 5 minutes it reverts back to "Use Custom Settings..." and therefore GMail (and other websites as well) stop working again.
How do I get Firefox to "Remember my History" and not revert my settings?
To see History and Cookie settings in Tools > Options > Privacy, choose the setting Firefox will: Use custom settings for history
You need to make at least one change to make the custom setting stay selected.
If all settings are the default then the History and Cookie setting revert to Remember history the next time you open Tools > Options > Privacy.
You can see the defaults in a screenshot in this KB article: Delete browsing, search and download history on Firefox
If all settings are the default then you will see "Firefox will: (Never) Remember History".
The "Use custom settings for history" setting reverts to "(Never) Remember history" if all History and Cookies settings are the default.
Do any settings change in that section?
Are you allowing all cookies or do you make an allow exception for specific sites?