While increasing the max connections on the server config may fix the problem, you should consider verifying your application configurations and implementations.
I'm not an expert on Magento, but as I recently had a similar issue on a project I was working on, I noticed that the default implementation of the framework I was using created a connection with every call to the database.
While that may not cause any problems to some, the moment you have more visitors or some tasks that are database intensive and can run on multiple connections, the best way to prevent the server crashing with "TOO MANY CONNECTIONS" error is to implement a database connection pool.
This prevents the application from creating more connections that the server can handle, and not crashing the application to the users. A connection pool would keep a queue for the requests to access the database until a connection becomes available so it can proceed with processing the users request.
Just keep in mind that the connection pool should be thread safe in a multi thread scenario.