Is this The House Next Door (2002) by Richie Tankersley Cusick...?
According to the Goodreads synopsis, the protagonist, Emma, bets her brother that she can spend the night at the spooky, abandoned house next door:
On a whim, Emma Donovan bets her twin brother, Charlie, that she can spend the entire night alone at the spooky, abandoned house next door. The place is seriously creepy, but she's determined to overcome her fears and prove her brother wrong. Until she finds herself reliving a horrific night from the house's past and a passionate love with a handsome -- and strangely familiar -- young man.
When Charlie finds her, he's sure it was all just a dream. Yet Emma has persistent paranormal experiences involving the house and the young man from the past. As her "dreams" intensify, Emma becomes convinced that they are very real...and that she has a dreadful part to play in the supernatural reenactment of a tragic love.

The following review covers most of the other plot points you mentioned:
- Emma encounters a man named David in the cellar of the house and falls in love at first sight. Her feelings deepen with each subsequent visit.
- She learns that David is the ghost of a man who died in a fire about a hundred years earlier.
- She also learns that around the time David died, there was another girl who looked just like her, was the same age, and had the same name.
The House Next Door is an interesting love story and it begins when Emma Donovan spends a night at the haunted house, next to her house, because of a dare with her brother, Charlie. Actually what really started this story was when Emma fell through a hole on the porch causing her to land in the cellar. She feels so weak that she can’t move, she can’t open her eyes. But then she hears a voice, one that is so strong, so rich and beautiful. The moment she opens her eyes, she falls in love with a handsome man with dark hair, irresistibly, stirring eyes, but for some reason she can’t see him that well; he seems so translucent. This man’s name was David and Emma loved him. When she was around him and in the haunted house, she didn’t feel like herself, like someone else was controlling her. Charlie thinks she’s going crazy ever since they found out that David was a ghost; he had died in a fire about a hundred years ago. Emma also thought about this. Why am I in love with David and why does he love me? How does he even know me if he died about a hundred years ago? There was a story behind all of this. Each time Emma visited the haunted house, her feelings for David became stronger, deeper. It seemed like he wanted her… and she wanted him, too. After finding some information in the library, Emma saw that there was another girl her age, with her same name, around the time David died. She also looked exactly her and Emma thought, is this why David loves me? He loves this Emma so much that he thought I was her? What is the real reason? Find out by reading this incredible love story with it’s terrible tragedies.