Benefit of having more than required courses on a Ph.D. transcript
Once you have your doctorate people are very unlikely to care which courses you took to get there. Especially in academia, though there might be some value for a specialized industrial job.
The trick, however, is whether sitting in will give you enough incentive to learn the material enough to benefit your research. Probably it will, based on your question, but some people need a goad to work hard.
If the knowledge will be helpful and you can put in some effort, then I'd suggest just sitting in (or auditing) would be best. You don't want additional courses to actually interfere with your research.