How do I extend electrical boxes 3 inches or more?
Old work electrical boxes are designed to mount directly to the drywall.  They have a flange that rotates out to grip the drywall from behind, pulling the box forward and tight against it:



When installing them, it's best to cut the opening with a knife (as opposed to a drywall router, say) so that the box fits snugly in the hole.