The answer is stall without looking like you're stalling. Acting helps. In wrestling, shitty fake shots from neutral, tying up 'hard' then forcefully breaking the ties while making loud noises helps. any cross body and leg ride while tugging at a leg or arm without much intent looks like you're being busy too.
In sub grappling, sitting in closed guard while periodically jumping to your feet for a moment and circling a bit /pushing down on the leg a bit makes it look like you're trying to pass when you're really just trying to breathe. If you start losing your posture, just return to your knees safely again. Within guard, just keep it closed and periodically rotate your hips to an angle, underhook a leg or foot, and 'try' to sweep.
And of course, injury time/equipment time is always there as a last resort as well.
Basically, I try to look busy, I make a few periodic violent/quick movements without much intent, and I might even ham it up with some intensity or frustration noises to make it look like I'm the one pushing and the opponent is the one stalling. It's not the prettiest part of the sport or the part that any of us are most proud of, but we've all hit the wall at some point, and it's good to know how to preserve what little energy you have left without getting hit for passivity so you can hold on to a lead or make one last push at the end of the match. I'm not exactly proud of this stuff, but I certainly don't lose sleep over any of it if I manage to pull out a win because of it.