Accessing Gmail via IMAP using Lion's Mail client
Firstly, if you're using Gmails two-factor authentication, you'll need to setup a one-time password for Mail.app to use.  From the look of it, you are not using this feature but you probably should and so should everybody else so I'll include the steps for completeness.  You can create a new one-time password by going to your Google Account settings (not Gmail settings).  You'll see a section like the one in the image below.

Click on the 'Edit' beside 'Authorising applications &amp; sites' and enter your google account password when prompted.  You'll be brought to a page where near the bottom you can name the app you're creating a one-time password for and then click create password.  See image below.

Your password will be generated, spaces in it don't matter so you can just select it and copy to the clipboard.  Then open the Mail.app and if you don't get the dialog for adding an account, you can bring it up by clicking Mail > Preferences and you can click the '+' symbol at the bottom-left to add a new account.  Put your gmail address, including 'gmail.com' in the 'Email Address' field and you newly generated one-time password in the 'Password' field and hit Enter.
Mail will connect to the server and validate then setup your account.
Click 'Create' when prompted and you're ready to go.  

Now, to manage the mail that your Mac will download and store locally you go to the Advanced tab for the account.  There is a dropdown (pictured below) which allows you to select what Mail will download.

If you don't want to download all mail and attachments, change the default to one of the other options shown below.
  


If you select 'All messages and their attachments' this will download every email you've ever sent/received which still exists in your online gmail account.  This is the default and probably the reason you exceeded your limit.  This should be a one-off problem though if you downloaded them all and this is what you want.  
If you select 'All messages but omit attachments', it will still download every mail you've ever sent as above, just without the additional bulk of attachments.  
If you select 'Only messages I've read' then Mail won't download unread messages, leaving you to read your unread mail on gmail in your web browser.  
If you select 'Don't keep copies of any messages' then you will only ever see mail in your Mail app when you are online.  Essentially this will function as if you're using your web-based email account on gmail.com but through the Mail app.  This means you don't use lots of storage on your Mac, but it also means you need to have an internet connection to use your account.  


I hope that clarifies your choices and helps you choose the best option which suits your needs.  Also, if you're going to use IMAP, which you probably should, you should stop using POP.  

In GMail settings, you can also limit the number of mails which can be held in an IMAP folder to various limits between 1000 and 10000