Borrow means to take something from another person, knowing you will give it back to them. Lend means to give something to another person expecting to get it back. The sentence was referring to the friend hence lend is the correct answer since the friend is the one lending the pen.