Apple has made some strides when it comes to making Mail behave better with Gmail, but this working relationship still has a few catches.
Deal with archiving issues: One of Gmail’s perks is a ridiculous amount of storage space, so Google has set it up to highly encourage archiving your email instead of having to make the decision to delete just some of it. After all, you never know if that rainy day will come next month or four years from now, and there’s no harm in keeping tiny emails around in this age of ever-expanding storage space.
As of OS X 10.7 and 10.8, you might notice a new Message > Archive option in Mail’s menu. You can also use View > Customize Toolbar to add an Archive button to the toolbars of Mail’s main window and individual message viewer windows. Unfortunately, after two years and a number of bug reports filed with Apple, that button still doesn’t work properly with Gmail.
Press the button, and it will create a new top-level folder called Archive where you can now store messages that you don’t need in your Inbox, but that you want to be able to search later. This does not follow Gmail’s behavior on the Web of moving messages to All Mail, which means that messages archived through Mail won’t be stored in the place Gmail understands.
If you rarely sign into Gmail on the Web, you don't need to worry about this. But if you do - say, while on vacation away from your devices or using a different work computer - some of Gmail’s built-in archive and search features won’t know to look in the Archive folder that Mail created.
Since you can’t fix Mail’s archive behavior with Gmail accounts, and you can’t tell Gmail to archive in a different folder, I propose a compromise. In Gmail’s settings, under the Forwarding and POP/IMAP tab, change the setting When I mark a message in IMAP as deleted to Auto-Expunge off. Then, just below that option, change the setting When a message is marked as deleted and expunged toArchive the message. Click Save at the bottom of the page. Once you tweak settings in Mail in a later step, using the Delete key on a message will tell Gmail to archive it in All Mail. If you truly want to delete a message, you can drag and drop it to the [Gmail]/Trash folder.
Tweak your labels: In the past, if you applied multiple Gmail labels to a message in your inbox, then searched for that message in Mail, you’d be flooded with duplicate messages—one for each label, another for its appearance in the inbox, and another for its All Mail entry. But happily those days are over. Now, Mail is smart enough to map Gmail labels to different folders. For example, if you’re on an email list for a hobby or your kid’s sports team, you can apply a Gmail label for “T-ball” as well as a second label of “Follow Up” for messages that you can’t deal with right this moment. The message will appear with both labels on the Web, or in two different folders—T-ball and Follow Up—in Mail. (Tip: to use multiple labels, or folders, in Mail, right-click a message and choose Copy To instead of Move To).