I use GMail a lot, and love the Archive feature. The problem is that when I use Mail.app on my iMac it doesn't have an Archive button or Archive the messages when I delete them. It actually DELETES THEM, which is not what I want. So, I figured out how to do this in a real easy way.
In Mail.app:
1) Near the bottom, expand your GMail folder
2) Expand the [Gmail] folder inside
3) Select the All Mail folder inside
4) Go to the menu item Mailbox >> Use this mailbox for... >> Trash
5) Collapse the Gmail folder now; no need to look at it again
6) Press Command-, (comma) for Preferences
7) Select Accounts tab
8) Select the same Gmail account in the Accounts list
9) Click Mailbox behaviors
10) In the Trash section, KEEP CHECKED "Move deleted message to the Trash mailbox"
11) UNCHECK "Store deleted messages on the server"
12) Set "Permanently erase deleted messages when:" to NEVER
13) Close the Preferences window and click SAVE
Voila! Now when you delete messages from your Inbox, they get Archived. You can double-check this by logging into Gmail and deleting a message in Mail.app then refreshing your web Gmail inbox. I'm using Mail.app version 4.4, but i'm sure this setup works on many previous versions.
In addition, if you want your Mail.app emails to look just like GMails with threaded conversations, make sure you're viewing your GMail account, then go to View >> Organize by Thread.