Actually I do not think this is something you would want to change under nearly any circumstances. You should not fix the symptom, but should find out the problem.
Does the mysql log contains information about aborted connections? Does the syslog of that server contain information which might be relevant? Do you run a more or less decent version of mysql? (At least the most current minor version.) Have you checked if the database server runs out of resources (e.g. RAM, because swapping is really bad for any DB server)? Have you compared the number of connections your webserver maximally issues simultaneously to the db server and the number of connections your db server is processing in parallel from its configuration file?
Have you tried pinging the database server from the web server for a long period of time? Does the ping slows down (or gets lost) too, when the error message pops up in your application?
You should check all that before you change anything in timeouts.