As most of you all know you need to prevent your content databases to expand too much. According to best practices from Microsoft you should keep your content databases around a maximum of 50 GB. Keeping the content databases small, makes it easier to backup or restore them. This sounds like its really easy to do this, but to bad.... it isn't.
There is now way you can tell a content database automatically to stop growing and continue in another new content database if it gets to big. There is an option in Central Adminstration to set the number of Sites. You could define per site how large it can be and use that in combination with the maximum allowed sites as a maximum storage. But Central Administration will only send an email or even denies the creation of new sites in the content database if it gets to its maximum.
Content databases can be set to two different status which are important to understand. These are:
Each content database belongs to a web application. Its state can be changes in "Manage Content Database Settings" by clicking on the content database in "Manage Content databases".

When you want to use a new content database, you have to create yourself a new content database and set its status to "Ready". To prevent the previous content database to be used (and thus growing) you have to set its status to "Offline". These things can only be done through the Central Administration or by programming some code.
Doing this by code:
public static bool ExpandDatabase(SPSite site)
{
bool success = false;
try
{
// get current content database
SPContentDatabase currentDB = site.ContentDatabase;
// set the current database offline which means it
// can be reached but not written to anymore
currentDB.Status = SPObjectStatus.Disabled;
currentDB.Update();
// create a new name
string newName = currentDB.Name + string.Format("_{0}", site.WebApplication.ContentDatabases.Count);
// create the new content database and activate it
SPContentDatabase newDB = site.WebApplication.ContentDatabases.Add(currentDB.Server, newName,
currentDB.Username, currentDB.Password,
currentDB.WarningSiteCount, currentDB.MaximumSiteCount, 0);
success = true;
}
catch (Exception)
{
}
return success;
}
This code set the current database of the web application to an offline state which prevents new sites to be created in there. Secondly a new content database with a new name for the web application is created and set to the state of ready. Therefor any new site created will be created in that content database. Below you will see the result when you have a look into the Central Administration.

So when do you know when you have reached the 50 GB? There is not a really an easy way to determine in bytes the size of a site, site collection or content database. I have posted some time ago an article describing how you could determine the size of your SPWeb object based on its folders and files.
But you could also use the following method to determine if there is a need for a new content database. The method DiskSizeRequired of the object SPContentDatabase indicates in bytes how much disk space it will take to backup the content database.