I did this right before the 3rd meeting with Miranda. I used the Gibbed's Mass Effect 3 Save Editor. I applied all of the following settings and it worked. It has an early and a late section, but I just did them both late.
(edited from original comment by [email protected] in the GME3SE FAQ)
before you meet at citadel docking bay 24d - early in the game
SET
id: 5209, name: "Romanced Miranda",BOOL YES
id: 3304, name: "Broke Up with Miranda",BOOL NO
INT: 266, name: "Romance state with Miranda",INT 5 (so 266, then in the next box 5)
id: 177, name: "Miranda is loyal",BOOL YES
id: 33, name: "Miranda acquired",BOOL YES
id: 195, name: "Miranda is dead",BOOL NO
or later in the game
id: 21750, name: "Miranda - romanced",BOOL YES
id: 20184, name: "Miranda - warned",BOOL YES
id: 20278, name: "Miranda - killed"},BOOL NO
Enjoy the complete and total rip off that is the sex scene with Miranda in ME3.