I can't believe I finally have good news to report about this, but I finally have it working on my MacBook Pro with OS X 10.10.3.
I had been using Mailplane for months, but there were still so many things I liked better about Mail that after 10.10.3 I tried again.
I have 7 accounts - 5 are Gmail and 2 are generic IMAP. Some accounts have hundreds of thousands of emails going back 15+ years.
After trying again with 10.3.3, sure enough a few hours later Gmail stopped syncing. However, it was only having trouble syncing with one account, which I took as a positive sign.
I kept the Activity window open the whole time and noticed that just before syncing stopped, the Activity monitor would report it was doing something with a large cache of over 170,000 message. Most of the time that message would never disappear from the Activity window. Sometimes it would go away, but still syncing from that account stopped. And the progress bar for whatever it was doing never progressed.
So what I did (after first confirming I had nothing from that account in "On My Mac") was just this:
1. I deleted the account - which required deleting the account from Internet accounts in my case.
2. I then recreated the account. Note: When doing this I used all standard default settings. No "tricks" with hiding this or that mailbox or whatever. Just plain, vanilla Gmail account settings which are created automatically.
Full syncing took overnight. But after that - and it's been more than a week now - all my accounts, including all my Gmail accounts have been syncing perfectly! I think the problem might have been fixed finally!
For productivity improvement, I also did the following:
1. In the account settings, under Mailbox Behaviors, I unchecked the "Store draft messages on the server" option. This was not interfering with email syncing from Gmail, but if left on then sometimes outgoing mail annoyingly gets left in the Drafts mailbox even though it was sent. That's still a bit of a bug remaining. But you can avoid that annoyance by unchecking the box.
2. I added MsgFiler from the App Store. It lets you quickly file emails in mailboxes with keyboard shortcuts (and I have a large hierarchy of mailboxes in all my accounts) which, for me, is a huge time saver. It also does other things like let you open mailboxes with shortcuts, and create new mailboxes on the fly.
Anyway, I would try the complete removal of accounts which are not syncing (assuming they are IMAP accounts of course!) and then recreating them from scratch, as simply as possible, with all default settings. And leave your Mac on until all the caching and syncing is done (which you can monitor in the Activity window).
In the meanwhile, I'm a happy Mail camper again for the first time since Mavericks!
doug