Dragons and Lions reached the last 16 of the European Challenge Cup with the hosts progressing by earning two losing bonus points in Ystrad Mynach.
Will Reed's try gave Dragons the lead before scores from wings Quan Horn and Edwill van der Merwe put Lions ahead.
Jordan Hendrikse's boot kicked Lions into a 30-5 lead before tries from Aki Seiuli, Jordan Williams and Rio Dyer gave Dragons hope of a comeback.
JJ Hanrahan's late kick made it 30-25, but Dragons could not win it late on.
Dragons will go to Glasgow in the last 16 on the weekend of 31 March-2 April, 2023, but also host them in the United Rugby Championship beforehand on Saturday, 28 January.
The match took place at the Centre for Sporting Excellence in Ystrad Mynach after the surface at Rodney Parade was deemed unfit on Saturday.
Lions and Dragons both entered the contest on eight points in Pool B, each having won, lost and drawn in their first three games.
Reed's try after 10 minutes, powering through two tackled to touch down in the corner, gave Dragons an early lead, but the momentum soon shifted.
The Welsh side were not helped by the early departure of Ross Moriarty, who was replaced after six minutes for a head injury assessment on his 50th appearance for the region and did not return.
Two penalties from Hendrikse put the South African side ahead before Henco van Wyk's lovely offload released Horn down his wing to score in the corner.
Less than two minutes later Lions had their second try, Van der Merwe showing his pace down the opposite wing to race away from Dragons defenders straight from the restart.
Despite missing that conversion, Hendrikse added three more penalties before half-time as Dragons were regularly penalised at the breakdown.
Hendrikse took Lions' tally up to 30 with a penalty early in the second half before Dragons welcomed back prop Leon Brown for his first game in nine months.
However, it was the other replacement prop who got Dragons back in the game, Seiuli crashing over from a metre out after a powerful driving maul from the hosts.
Dragons had their third try on the hour mark as full-back Jordan Williams finished off a slick routine from an attacking scrum to reduce the deficit to two scores.
Dyer got the Welsh region's fourth try of the afternoon with 14 minutes remaining, the wing scoring in the corner after more good work from the Dragons pack in the second half.
However, for the third time in the match the conversion was missed so Dragons remained eight points behind their opponents.
Replacement fly-half Hanrahan kicked Dragons' first penalty of the match with five minutes to play to cut Lions' lead down to five points.
But they could not win it in the final minutes, as Lions held on to secure a home tie in the last 16, while the Dragons will now have to travel.
Coach Dai Flanagan told BBC Sport Wales:
"We play Glasgow next week (in the URC) so we've been doing prep on them, they play with high speed, high tempo especially on their (artificial) track.
"We've seen today (at Ystrad Mynach) that if you can control the speed of ball, we expressed ourselves and it was good for us."
Flanagan added: "We can't keep giving ourselves 20 points (deficit) to chase, as well as we played at the end when the effort and the character was unbelievable, it's about how we get better.
"We were losing yards in attack and defence, probably losing Moriarty affected that, because we look at Ross when we need momentum.
"Ross split his ear wide open, he's got stitches in his ear, I think there was concussion since he couldn't go back on so we'll look after him.
"We were better mentally and physically on the road last week (in Pau), so it'll be good being away (in the last 16) in the long term."
Dragons: Jordan Williams; Rio Dyer, Steff Hughes (capt), Max Clark, Ashton Hewitt; Will Reed, Lewis Jones; Rob Evans, Bradley Roberts, Lloyd Fairbrother, Joe Davies, Ben Carter, George Nott, Taine Basham, Ross Moriarty
Replacements: Brodie Coghlan, Aki Seiuli, Leon Brown, Sean Lonsdale, Aaron Wainwright, Rhodri Williams, JJ Hanrahan, Jack Dixon
Lions: Andries Coetzee; Quan Horn, Henco van Wyk, Marius Louw (capt), Edwill van der Merwe; Jordan Hendrikse, André Warner; JP Smith, Michael van Vuuren, Asenathi Ntlabakanye, Willem Alberts, Darrian Landsberg, Jaco Kriel, Emile van Heerden, Emmanuel Tshituka
Replacements: PJ Botha, Morgan Naude, Ruan Smith, Pieter Jansen van Vuren, Ruhan Straeuli, JC Pretorius, Morné van den Berg, Rynhardt Jonker.
Match officials
Referee: Adrien Marbot (France)
Assistants: Thomas Chereque & Stephane Boyer (France)
TMO: Christophe Berdos (France)