Can a PhD student write a letter of recommendation for coauthor/collaborator?
Can you write it?

Yes.

Will it be worth much?

No.

An ideal letter of recommendation (for schools in the USA) will talk about the candidate's ability to do doctoral-level research from the vantage point of someone who has supervised students through the various stages of their career. While your letter will be better than one from their priest or their coach, it still won't count tremendously in their favor. 

Unless this person's only other option is his priest or coach, I'd suggest that you decline.