Is it okay to upload the PDF of my non-open access papers in academia.edu or research gate?

The current best source for answers to this question is the SHERPA/RoMEO database, which categorizes all journals by their policies.

This tells you, for most respectable journals, what you are legally allowed to do in terms of posting versions of the paper on other sites (this may, of course, be modified by local laws; for example, documents produced by US government employees are not generally protected by copyright).

For a large number of journals, you are at least legally allowed to post preprints. In such a case, I see no advantage in flouting the law by publishing the journal's final version instead: I believe a preprint is generally sufficient to make your work more readily accessible and gain you the open access citation benefits.

As for journals that do not allow you to post preprints: you need to make your own moral and personal judgement on whether you will submit to such journals at all, and if so, the degree to which you will comply with the law.