Doing some hand/wrist stretches may help with that.
@Ed Seith did a short video on Instagram with stretches that I know have helped me have less pain/tension in my fingers/knuckles/joints especially after longer playing sessions as well as allowing me to stretch further. Make sure not to hurt yourself by stretching to much or far, just enough to comfortably stretch it out. Other members may have better advice but off of the top of my head I remembered this stretch has helped he ease tension in the past. I normally do these before I start playing, after a while of playing if it's a longer or heavier session I'll do these stretches if I feel like my fingers are feeling tense, and after I put the guitar down I'll sometimes do these stretches as well. I'll also pull my individual fingers back as far as I comfortable can with my opposite hands thumb next to the knuckle of that finger to keep the base in one spot so it doesn't bend to far back. Sorry if the wording for this is confusing. I'm not quite sure how to type out how I stretch that way haha. Anyway I hope this helps. Although I'm not sure what your stretching limits are, just how much joint pain you have, or if these stretches aren't great for bad joints in general. So take it with a grain of salt.