Go back to basics...
Firstly, wash the carpet with biogical washing powder to get the smell out. If he can smell it, it will say 'toilet' to him.
What time do you put him out in the evening? Try letting him out at 11.30pm for last wee and/or poo. Supervise if you have to, to ensure that he's done it.
Get up at 5.30am and let him out for a wee/poo.
If he hasn't done a wee or poo -huge fuss. If he has, clean up with no fuss.
If he goes several days with no wee/poo doing this, then get up at 6am, etc. Similarly, you'll be able to let him out a little earlier, and so on.
Patch was, bizarrely, dry at night from day 1. He took until he was about 9 months to be consistent in the day though, especially if the weather was bad (because he's a wuss).