The Lakers and LeBron James have agreed on a contract extension that will keep him in Los Angeles.