Okafor split a pair of foul shot attempts with 5.2 seconds remaining for a one-point Wizards lead.
Beal grabbed Okafor's missed second try, was fouled, and added a free throw of his own to seal the victory -- the Wizards' sixth in eight games.
Okafor finished with 17 points and 11 boards. Trevor Ariza contributed 18 and six assists for Washington.
The Rockets got a game-high 27 points, six assists and three steals from James Harden as their two-game winning streak came to an end.
Chandler Parsons helped out with 24 points, seven boards and five 3-pointers for Houston.
McPhee, Cokas 'working on their marriage' after affair
Handler slams Piers Morgan: 'You're a terrible interviewer'