In order to make sure that a high performing student does not completely take over the work and leave his/her peers out, it is important to clarify their roles.

The teacher can lay out instructions like checking in with the struggling peer to make sure they are on the right track and helping them clarify their doubts rather than simply giving them answers.
After assigning the task to the students, it is important for the teacher to structure the activity before letting them start. This can maximize peer learning.
Suppose a teacher has assigned a passage from a book followed by 4 comprehension questions which are to be completed in class. These are the instructions the teacher can set for the students:
STEP 1 – Use the first 6-7 minutes to individually think about the answers to the questions
STEP 2 – Once you are done, discuss the questions and their answers with your partners. Analyze the similarities in your thoughts and clarify the differences with each other and come to a common response before writing down the same in your own words. The high performing peers will make sure that they can help their struggling peers by encouraging them to be vocal about their response and fill in the gaps in their answers. Check whether their answer is missing an important point and make them understand the same rather than just telling them the right answer. The struggling student must also take the responsibility of understanding the answer rather than simply writing down their peer’s response.
STEP 3 – After the discussion session, any pair can be asked to discuss their response with the class
By structuring this activity and explicitly laying out instructions, students understand they have a responsibility towards their peers and the struggling student will not be scared in attempting the questions individually as they will know that there will be space and time for them to clarify their doubts and get to the correct answer.
Students will be more motivated here as they know that they can be asked by the teacher to share their response with the class. They will not be uncomfortable sharing their response with the whole class as they have had a chance to work out their response with their peers.
Here, it is also important to remember that small feedback should be given to the pairs who share their response with the whole class.