If your dive buddy runs out of air you have two problems to solve.
1. You must give him access to your air supply to breathe until you get to the surface. You can give him the 2nd stage regulator out of your mouth to breathe. He will feel comfortable with that. You can continue to breathe with your Air Buddy.
2. You have to get him safely to the surface. Besides not having his own air to breath he might also not be able to inflate his BCD to gain buoyancy. He will probable resist you if you try to jettison any of his gear to make him lighter. You don't have to stress yourself to liftg him to the surface. You can simply take the Air Buddy out of your mouth for a few seconds, press it to the mouthpiece of his BDC and shoot air into it, guiding him in a controlled ride to the surface.