I had this error on a site that was not using phpBB , but it was a php mySQL site.
For us, the error was caused by relaxed coding. For example, we did not close the mySQL connections. Additionally, instead of checking to see if thee was a connection already open, we'd open a new connection on each call. When our site was small, roughly < 5000 sessions a day, there was not a problem.
As soon as we started to rock, the coding challenges became apparent. Once we cleaned up the code, and increased the RAM the problem went away.
I am note sure about the scalability of phpBB, but from what I've seen in the drupal community scalability is an issue.