Tell the MS student that you're going to be asking the PI for a letter of recommendation, and ask him if he'd be able to offer his input to the PI.
When you ask the PI, tell them that (the MS student) said he'd be willing to offer his perspective, since you worked closely together.
Regardless, the letter should be from the PI. If the MS student writes it for the PI, that's fine, but it should be from the PI.