Is there a way to increase the connection timeout for ActiveRecord?

I keep getting this error when I have more than 25 threads with a pool size of 5.

> 
> (ActiveRecord::ConnectionTimeoutError) "could not obtain a database connection within 5 seconds (waited 5.000144774 seconds). The max pool size is currently 3; consider increasing it."
> 
> 
> 

If there is not a way to increase the connection timeout, what is the best way to ensure a thread is using a connection as quick as possible?