Do it gradually IME. It takes longer, but it preserves the benefit of why you decided to stay with him in the first place and so it feels kinder.
One way to do this is to try reducing the contact over time, so if you currently cuddle him to sleep, you could change to sitting on his bed with a hand on his back or leg.
Then you change to sitting next to his bed and holding his hand. Then sitting where he can see you. Then sitting close by but out of sight. Then sitting with your back against the bedroom door. Then sit on the other side of the door (at which point, you can sneak away if you want to, or you can be honest and progress to sitting in your own bedroom and last of all going downstairs.)
Personally I would not put a time limit on each stage, I would only progress to the next stage when the child is genuinely OK with the current stage. If you want to rip off the plaster then just do it in one go, but if you want to do it slowly, IMO go at their pace.
When you get to the stage of actually leaving the room, some older children will request that you come back to check on them. I would recommend saying yes, but saying you will do this after a long enough time period that they are highly likely to already be asleep, e.g. 1 hour later, or when you go to bed yourself. This means that you can do it initially, and in a fairly short space of time they often stop requesting it because they feel secure that you will be there if they need you.
Or the other way to do it is to have longer and longer absences. So you invent an urgent but short need like you really need a wee, but you promise you'll be back. Do only this, even if he is upset by it, and not every night, until he is calm throughout you leaving and returning because he trusts you will come back - that's the state you're aiming for. Then start inventing longer reasons to leave. Say you need to hang some washing up, or check on yours/DH's dinner, or do some work, but you will be back in 10/20 minutes. Over time, make the absences longer and more frequent, however only if he is managing them OK. If he is getting distressed and agitated or calling out for you, don't increase at that time and if it's not getting better, consider reducing them a bit or going back to more very short absences. With this you're aiming to build confidence in the fact that you can leave and he will be OK because he knows you'll come back. When you're ready to increase to longer absences, you can either just start spending more time away and hoping he falls asleep waiting, or you can explicitly say that you need to go now, but you will be back in 1 hour to check on him, or you'll check on him later when you go to bed. For this method, it really helps if they don't have a visible method of telling how much time has passed. If they have that to focus on then it's just likely to keep them alert whereas you want them to be slipping into a more sleepy, relaxed, maybe bored state where sleep will take over.
Bear in mind that in the middle stage of this, when the absences are longer than 1-2 mins but not so long that he falls asleep, it will potentially keep him up later temporarily because he might get into more of a stressed/awake state waiting for you, and you're not really leaving long enough for him to fall asleep. Or worst case scenario, he'll nearly be asleep and then you coming back might even wake him up and start the whole thing off again. So this might be a good strategy to try during something like summer holidays where you don't need to be so worried about him not getting to sleep until really late. Either that or you can actually skip the intermediate stage, so keep your timed absences capped at about 10 mins and then every few nights, just do one where you stay away for much longer, listening out for ~30-40 mins to see if he calls out to you and if he does, go back but if he doesn't, then in the morning you say "I was just hanging out the washing, but you must have been so tired, when I came back in you were already asleep!" When this is happening consistently then you might be able to suggest the "I'll come back and check on you later" as well.
It can also sometimes help to offer some alternative such as an audiobook or children's meditation playing at a very low volume, some relaxing music, or a light projector etc (just beware the ultra cheap ones from amazon/Temu/etc - some of the electronics are dodgy, and I wouldn't want that in a child's bedroom in case of fire.) However I'd stick to one thing at a time, don't throw loads of different options at him!
Taking a stance that this is what we're trying now, and no, I know you might not like it but I know you can handle it, can often help - especially if you know that this is really just one step away from what he currently does, so you know that it likely is possible for him to adapt to it. Something that sometimes helps is to imagine a situation which forces abandonment of the current arrangement - for example, imagine that you have a shoulder injury which makes it painful to lie in bed with your child, or if you went on holiday and the bed was physically too small for you/DH to fit in - what would you do in that situation? You would probably expect it would take a bit longer than usual to settle, but your DS would probably also be fine.