We recently purchased at auction a four-year-old ex-government Toyota Aurion with apparently a poor service history and 75,000 km on the clock. First inspection of the oil filler cap revealed a congealed glug of old oil. The motor began to spew white smoke out of the exhaust after standing for some time, but more embarrassingly we can hear a very tinny clatter, clatter, clatter coming from the motor, and there's a plume of smoke that completely engulfs the car behind. The Toyota dealer recommended taking it on a long run and to then change the oil and oil filter. Did that and no change, no improvement, so off to another mechanic with diagnostic equipment and he changes the oil again and puts in engine flush. Still no improvement. On the long trip the motor used four litres over the 800 km.
You say the car had a poor service history when you bought it, and there was sludge under the filler cap. Both should have been warning to you that this car hasn't been well cared for; you are now paying the price. Sludge builds up in the oil galleries when the oil isn't regularly changed, and if let go long enough can cause blockages that can be fatal to an engine. It's rattling, using a lot of oil, and blowing a lot of black smoke, you should have it pulled down and inspected, and possibly rebuilt.