How to keep mac, iphone, icloud and gmail contacts in sync?

Mail

use the Gmail template on iOS to have the best Gmail experience on iPhone, use Sparrow to have the best experience on Mac. It will use your Gmail contacts and the one you have on Address Book.

Contacts

Use iCloud for contact syncing on the Mac and the iPhone. You won't have the contacts on the Gmail webapp, but you can still find them on icloud.com.