Houston Police said Bun B's wife answered the door to a man holding a gun and demanding property as he forced his way into their home.
Bun B's wife directed the suspect, identified as 20-year-old DeMonte Jackson, to their car in the garage.
Bun B, whose real name is Bernard Freeman, heard the commotion, grabbed a gun and came downstairs.
The rapper confronted Jackson in the garage as they both fired shots at each other.
The suspect ran away and later showed up at a hospital for treatment for a gunshot wound to his shoulder.
Jackson has been charged with two counts of aggravated robbery and one count of burglary.
Bun B, who police said has not been charged, was not injured. Neither was his wife.
Bun B is best known as half the rap duo UGK, a group credited for hits including, "Pocket Full of Stones," "Ridin' Dirty" and "Int'l Playas Anthem."
Copyright 2023 by Cable News Network, Inc., a Time Warner Company. All rights reserved.