I am trying to get three days of stool samples from my cat, but he only ever does the toilet when I’m asleep and by that time my other cat has also gone to the toilet so I don’t know whose is who’s. Any ideas how I can collect this?
Depending on what the purpose of the stool sample is, collecting a mixed sample might be perfectly fine.
For example, if the purpose of the sample is testing for Giardia infection or other parasites that are easily transmitted, it is common to treat all cats in the household upon a positive test result anyway.
Even if this is not the case, it might suffice that there is definitely stool from three days of the intended cat in the sample and contamination with stool from another cat is not an issue, your vet will be able to clarify on this.
If this isn't the case, and you really need a sample from one specific cat and that cat only, for light sleepers I'd recommend just moving the litter boxes to your bedroom.
They'll wake you up with the digging and you'll have just enough time to come to your senses and flip the lights.
Apart from that, learning to tell the stool from one of your cats from another even without having seen them defecate is highly beneficial, even if it is just a "best guess" you'll know which cat to watch for other indications of issues when stool is unusual.
There are clues, e.g. most will have one favorite litter box to defecate, or prefer a specific area of the litter box, build distinctive mounds when covering up, etc.
There is a technique I have read about, although not tested it myself. You have to get the sick cat to eat something containing concentrated food coloring, maybe hide gel coloring in an empty medication capsule and stick it in a creamy treat. Use a color that will show through, blue or green. Then collect the colored feces.
Edit the warnings in comments looked valid, so I looked up the source where I have it from. It is a book called "The cat behavior answer book". It has no discussion on using specific types of food coloring. The author seems to work as a full-time "pet expert", so there is some hope she would have added warnings if the technique were unsafe.
give one cat a few drops of red or green food coloring by mouth or in some canned food. His stool will look distinctly more vibrant than those of the other cats. If you have more than two cats, wait a few days and test another cat or give two cats different colors