There are no absolute rules, but staying within a decent width ratio helps.
Here's a link to a
tire/rim ratio chart that might help. Remember you're comparing nominal tire width to
inside rim width, so allow for the wall thickness if measuring the outside.
I find that going wider than the norm on tires is OK, but if you have cantilever brakes there might be issues with the swing clearance on the brake shoes. Also don't forget that fork clearance is the ultimate arbiter of how wide you can go.