<P> Barney meets Marshall around the same time as Ted, and takes it upon himself to give Marshall unwanted advice on picking up women . While Marshall makes fun of Barney's promiscuity and ethical lapses, however, Barney has helped him many times throughout the series . For example, Barney gets him an internship at Altrucell in "Life Among the Gorillas", keeps him from sleeping with other women in "The Scorpion and the Toad", persuades Lily to come back to him in "Bachelor Party", and gets him a job at Goliath National Bank in "The Best Burger in New York". Barney is "co-best man" with Ted at Marshall's wedding . Along with the other main characters, Marshall is present for the birth of Barney's daughter . In the episode "Slap Bet", Barney loses a bet with Marshall and agrees to let Marshall slap him five times at random occasions "throughout eternity". This is later extended to eight slaps in the episode "Disaster Averted". Marshall administers these slaps in the episodes "Slap Bet", "Stuff", "Slapsgiving", "Slapsgiving 2: Revenge of the Slap", "Slapsgiving 3: Slappointment in Slapmarra", and "The End of the Aisle". </P> <P> Barney makes many unwelcome sexual advances toward Lily throughout the series, and frequently implies that Lily is secretly attracted to him, despite all evidence to the contrary . Nevertheless, he considers Lily a confidante, seeking her advice on winning Robin over and telling her deeply personal secrets, such as his failed ambition to be a concert violinist . He also admires her skill at lying and manipulating people, considering it to be on par with his own . While Lily calls Barney "the world's biggest pervert" and a "womanizing creep", she also considers him one of her best friends . Along with the other main characters, Lily is present for the birth of Barney's daughter . </P> <P> Barney and Robin start out as friends, but he falls in love with her after they impulsively sleep together in "Sandcastles in the Sand". Throughout Season 4, he struggles with his feelings for her, until they finally get together in the season finale "The Leap". They become a full - fledged couple in season 5, but they break up in "The Rough Patch" when they find that they are making each other miserable . They never truly get over each other, however, even while they are dating other people . In the eighth season, he launches an elaborate plan to win Robin's heart (encouraged by Ted's future wife) that ends with Barney proposing to her . She accepts, and they get engaged . The final season revolves around their wedding weekend . After much doubt and soul - searching, they get married in "The End of the Aisle". The series finale, "Last Forever", reveals that, after three years of marriage, they get divorced because Robin's work schedule prevents them from spending any time together . They do not see each other again for several years, until Ted's wedding . </P> <P> Barney and Robin start out as friends, but he falls in love with her after they impulsively sleep together in "Sandcastles in the Sand". Throughout Season 4, he struggles with his feelings for her, until they finally get together in the season finale "The Leap". They become a full - fledged couple in season 5, but they break up in "The Rough Patch" when they find that they are making each other miserable . They never truly get over each other, however, even while they are dating other people . In the eighth season, he launches an elaborate plan to win Robin's heart (encouraged by Ted's future wife) that ends with Barney proposing to her . She accepts, and they get engaged . The final season revolves around their wedding weekend . After much doubt and soul - searching, they get married in "The End of the Aisle". The series finale, "Last Forever", reveals that, after three years of marriage, they get divorced because Robin's work schedule prevents them from spending any time together . They do not see each other again for several years, until Ted's wedding . </P>

When did barney and robin get back together