Hi michelleg
Welcome to the Forum!
The hedgehog got into your courtyard, so presumably it could get out the same way. They are surprisingly good climbers and can squeeze through surprisingly small gaps. Are you certain it isn’t going out at night and then returning – i.e. do you have a night camera to keep an eye on the hog’s activities. If not it might be worth trying to get one or borrow one. Normally hedgehogs would visit several gardens during a night. If it’s possible maybe you could create a hog hole so it can come and go more easily.
But the way I see it, the hog has chosen your courtyard/outhouse so there must be something it likes about it. If you have anything dangerous around i.e. chemicals, netting etc. it would be good to move it to where the hog can’t reach it. Here is some information about some garden hazards:
https://www.hedgehogstreet.org/garden-hazards/
But if you are worried that the hog might be unwell (for instance if it is not moving much) you could always contact a hedgehog rescue and take their advice. You can get contact details by ringing BHPS on 01584 890801
Good luck to you and the hedgehog. Let us know how things go.