The 23-year-old midfielder rejoined the Millers on an emergency loan on Tuesday to enable him to play in their 2-0 home defeat to Watford.
He has now agreed a three-year contract at the New York Stadium. The fee is undisclosed.
Academy graduate Richard made 72 league and cup appearances for Boro, scoring four goals. He spent the second half of last season on loan with Rotherham, where he became a key figure in their promotion via the play-offs.