The hosts were good value for their 2-0 lead at half-time but were clinging on for dear life at the end of the game after Jake Hyde pulled one back for Barnet.
Chris Dagnall opened the scoring, taking advantage of some hesitant defending from the visitors to race into the Barnet box and fire a low drive wide of Jake Cole.
Chris O'Grady, Dagnall and Will Buckley all went close to adding a second before Barnet created their one chance of note in the first period. Micah Hyde found Albert Adomah, but his first-time effort was turned away by goalkeeper Kenny Arthur.
However, in first-half injury-time, Buckley was upended in the box by Gary Breen and Tom Kennedy fired home the resulting penalty.
After the break, Albert Jarrett hit the post with a free-kick and the Bees applied late pressure on the Rochdale goal. Paul Furlong saw a volley saved by Arthur, before Hyde volleyed home Yannick Bolasie's corner to set up a nervy finish for the home side.