I have to say that if I'm ever in a situation where I need to lie for anyone, I would hope it's just for myself. That way I'm the only person who gets in trouble if anyone finds out the truth. I can't imagine that situation ever arising, though, thank goodness.
Why risk getting the friend in trouble? I wouldn't do it. I'd be a reference for a good friend any day, but no lies.